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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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