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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
jsanchezm
Frequent Visitor

Get values from other table with conditional comparing values of two tables

Hi,

I've got an issue in Power Query and I can't figure out how to solve it:

 

In my scenario there are 2 tables: 

  • Mestres: that holds a few (about 40) records with specifically 3 columns that we need to use in our query: Tipus, CodiTip and Viatges.

jsanchezm_1-1685713186228.png

 

  • Vendes: a huge table that needs to add a column as a result from querying "Mestres". In "Vendes" we also have the "Tipus" and "CodiTip" columns, so we can compare both tables column's values:
    • if Vendes[Tipus] is T, then add a 0 in our new column in Vendes,
    • Otherwise, search in "Mestres" the value the column Viatges comparing the Tipus and CodiTip columns and if they match retrieve the "Viatges" value to put it in our new column in "Vendes".

Hope I've explained enough my problem. 

Thanks in advance for your time.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @jsanchezm 

 

You can use the Merge queries feature. Merge queries overview - Power Query | Microsoft Learn

You can select multiple columns to perform the join by selecting Ctrl as you select the columns. When you do so, the order in which the columns were selected is displayed in small numbers next to the column headings, starting with 1.

vjingzhang_0-1686036340179.png

After merging, expand only Viatges column to "Vendes" table. 

vjingzhang_1-1686036755312.png

Finally add a conditional column like below. 

vjingzhang_2-1686036840764.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @jsanchezm 

 

You can use the Merge queries feature. Merge queries overview - Power Query | Microsoft Learn

You can select multiple columns to perform the join by selecting Ctrl as you select the columns. When you do so, the order in which the columns were selected is displayed in small numbers next to the column headings, starting with 1.

vjingzhang_0-1686036340179.png

After merging, expand only Viatges column to "Vendes" table. 

vjingzhang_1-1686036755312.png

Finally add a conditional column like below. 

vjingzhang_2-1686036840764.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

lbendlin
Super User
Super User

You can do this with Table.AddColumn and custom comparators.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors