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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Conditional Merge with power query

Hi Everyone,

 

Wanted just to ask to the community here, if you think is possible to make a conditional merging with 2 lookup tables.

Let's say I have a data table and in this table a column (Address) with a list of addresses, but no country, only city, so I want to add a second column with the country.  This information is available to me but in 2 separated lookup tables in one some addresses and in another other addresses, in the lookup tables, each address has its country in a separate column, and, I want to program the M code so that if the address of data table matches the address of lookup table1, then it gives me the country from lookup table 1, if there is no match, the code sees if there is the match in lookup table 2, if yes, then it gives me the country from lookup table 2, if also here no match for my address, then, either it leaves it blank or it writes a simple "-".

 

Was wondering what you think about it/if anyone thinks it is doable? 

 

Thanks!

Stefano

1 REPLY 1
AlexisOlson
Super User
Super User

You can do both merges and then coalesce the two country columns into a single column.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.