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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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