Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Jamez_P
Regular Visitor

Power Query Column that looks up value in another table based on 2 criteria

Hi,

Thank you in advance for any help. I spent several hours trying to work this out and have hit a dead end.

I have a table called "Planning", which contains all of our future planned project assignments on a day by day per Worker basis (it is quite large). The two relevant columns here are Project number and Worker ID. There is a second table "Cost Rate Card", which contains Project Number, Worker ID and Cost. I need to check the current planning table row for the Project Number and Worker ID, match this criteria against the Cost Rate Card Table and return the relevant cost to the newly calculated column. Instead of returning null, it should return "90". 

I am 99% certain I want this calculated in Power Query M, as we are using a Power BI Online app to distribute the info and have setup the dataflows and app to automatically update and calculate, so my understanding is, that this will be pre-calculate for the end users.  

Many thanks

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Jamez_P ,

 

You can do a merge on Power Query based on several columns when you merge the two tables you just need to pay attention to the order you select the columns so that the sorting of the merge is the same.

 

https://community.fabric.microsoft.com/t5/Power-Query/Multiple-table-merge-with-multiple-column-cond....


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Jamez_P ,

 

You can do a merge on Power Query based on several columns when you merge the two tables you just need to pay attention to the order you select the columns so that the sorting of the merge is the same.

 

https://community.fabric.microsoft.com/t5/Power-Query/Multiple-table-merge-with-multiple-column-cond....


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks, I can't believe I forgot this was a possibility. For any other people with the same problem, you hold ctrl and select the columns in the order and little 1,2,3 etc. appear on each column in the merge window.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.