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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Ronnie7
Helper II
Helper II

Conditional Column with values from 2 tables

Hello,

 

I need to create a conditional column in the query editor ( that is, before the data is being fed into the model), based on values from two tables.

 

I know that the conditional column is good for values from one tables.

What would be they way to do so for values from two different tables?

For example (if [table1.col_name] = "x"  and [table2.col_name]="y" then...

 

 

Thanks!

2 REPLIES 2
Sean
Community Champion
Community Champion

@Ronnie7

If you insist on doing this in the Query Editor I think you'll have to Merge the Queries

before you can compare the values - but we may have to check with @ImkeF about this???

 

Look here

http://www.excelguru.ca/blog/2015/12/16/merge-tables-using-outer-joins-in-power-query/

and also

http://www.excelguru.ca/blog/2015/12/23/merge-tables-using-inner-and-anti-joins-in-power-query/

 

Hope this helps! Smiley Happy

 

ImkeF
Community Champion
Community Champion

Agree with @Sean.

I think that @Ronnie7 's question has an unspoken implication in it: That the matching values from the 2 columns have a common row-indicator 🙂

Which is normally not the row-number, but a matching attribute-value.

So as we don't have a data-model in the query-editor where the filters propagate, we need to join the tables on their common attributes in order to return meaningful data.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.