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
Anmolgan
Post Prodigy
Post Prodigy

How to do Conditional Join ?

I have different conditons that I want to match from the excel to powerbi query, below are those:

 

1. if table1[column1] = table2[column1] and table1[column2] = table2[column2] and if table[date] is in b/w 4 april 2019 and 30 march 2020 then pick up table2[column5] value and attach as a new column in table1.

 

2. If table1[column1] = table2[column1] and table1[column2] = table2[column2] and if table[date] is in b/w 4 april 2019 and 30 march 2020 then table1[column4] * table2[column5] value and attach as a new column in table1.

 

 

Now I tried using merge (left join) but somehow it gives duplicates rows and every calculation which was happening before gets incorrect becasue of the duplicates, I can do this with IF and logical conditons but problem is my spreedhseet contains 15000+ rows and it will not make any sense to write each line by line conditons for each of the following rows.

 

Does anyone has any better ideas for this?

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hi @Anmolgan ,

 

You can write m query with "each" to make automatic judgments in the advanced editor. You can refer to this case:
https://community.powerbi.com/t5/Desktop/M-Power-Query-help-for-table-merge-Conditional-Cross-Join/m...

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Can you suggest me an example of doing it? will cross join will not pick up every values that involves? how can I implement if conditions inside of cross join??

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.