cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Index Match in Power Query - M Code (for a MS Excel Brain)

Hi All

 

This is my very first contribution type post on the forum - so please be kind and bear with me if I made a mistake somewhere.

 

Just thought I'd make this post to save someone (new to Power BI like me) some time to figure out how to make the MS Excel Index/Match formula work in Power Query editor without using the Merge function.  I am using the Create a Custom column function to do this.

 

I got the initial code from this forum - cannot remember which post it was & it was before I even was a registered member.  Many thanks to whoever posted it, but I still had to figure out how everything links together since I am a newbie to M Code.  There were also some other bits and pieces I had to figure out to make it work for me.

 

There could also be other coding or DAX formulas that will do the job, but this is just one take on it that worked for me.

 

If it helps you - great!!  If there is an error in it somewhere, please let me know.  Just remember - this is how it made sense to my brain :-).

 

If there is a better way to do it - PLEASE reply and let me know.  I am hooked on Power BI and enjoying the journey.

 

 

DeonDP_0-1606435535449.png

 

1 ACCEPTED SOLUTION
Super User III
Super User III

Hello @DeonDP 

 

this is how a INDEX/MATCH in power query looks like in power query. However, I think it's better to join tables and then extract the first finding (the same as INDEX/MATCH is doing) because of performance issues, especially when tables are big.

 

Hope this helps

 

Jimmy

View solution in original post

2 REPLIES 2
Frequent Visitor

Thank you for your reply @Jimmy801 

 

As I mentioned, I am on a learning journey with Power Query & Power BI.  A journey that I think will probably continue way into the future.  The only reason for my post is to share in a little more detail, than what is doing the rounds , of how it is possible to do Index Match in Power Query.  If for no reason other than coming to the conclusion (for an Excel brain 🙂 ) in a similar position than me that joining tables could be a more efficient way to go.  I am working with rather big tables, and everything is just super slow to apply when I make a change in Power Query, so I think I will try to join more and lookup less.

 

Thanks again for your response.

 

DeonDP

Super User III
Super User III

Hello @DeonDP 

 

this is how a INDEX/MATCH in power query looks like in power query. However, I think it's better to join tables and then extract the first finding (the same as INDEX/MATCH is doing) because of performance issues, especially when tables are big.

 

Hope this helps

 

Jimmy

View solution in original post

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors