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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Bhargav150
Frequent Visitor

How to join multiple datasets in the Advanced editor using M code

I need to rewrite the below SQL code in M code, 

 

Select * from CTE1 A

Left join CTE2 B On A.JN  = B.LN or A.OLN = B.LN

 

1 ACCEPTED SOLUTION
adudani
Memorable Member
Memorable Member

hi @Bhargav150 

in the power query editor:
1. how to merge queries with a left join : Power BI Tutorial: Merge Queries in Power Query (youtube.com)

2. To join on multiple columns, hold "CTRL" to select multiple column headers while merging.
Alternatively, you can create a key ( merging multiple columns if required) 
https://www.youtube.com/watch?v=j-RBZQbWQOM&pp=ygUSam9pbnMgaW4gcG93ZXIgYnVp 

if this doesn't resolve the issue, kindly provide sample input and output data masking sensitive information

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

View solution in original post

1 REPLY 1
adudani
Memorable Member
Memorable Member

hi @Bhargav150 

in the power query editor:
1. how to merge queries with a left join : Power BI Tutorial: Merge Queries in Power Query (youtube.com)

2. To join on multiple columns, hold "CTRL" to select multiple column headers while merging.
Alternatively, you can create a key ( merging multiple columns if required) 
https://www.youtube.com/watch?v=j-RBZQbWQOM&pp=ygUSam9pbnMgaW4gcG93ZXIgYnVp 

if this doesn't resolve the issue, kindly provide sample input and output data masking sensitive information

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.