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
sivashankr
Helper II
Helper II

Left Outer Join for Multiple Tables

Hi Team,

 

I do have 4 tables lets say A, B, C and D and my sample SQL statement looks like as shown in SQL#1 below.

I was trying to mimic the same in Power BI using Advanced Editior-->Merging. But I see the different result and the SQL it generates looks like as shown in SQL#2 below.

 

SQL#1:

SELECT * FROM A

LEFT JOIN B ON A.C1=B.C1

LEFT JOIN C ON A.C2=B.C2

LEFT JOIN D ON A.C3=D.C3

 

SQL#2:

SELECT * FROM

     (SELECT * FROM

               (SELECT * FROM A

                 LEFT JOIN B ON A.C1=B.C1

                ) AA

        LEFT JOIN C ON AA.C2=B.C2

    ) BB

LEFT JOIN D ON BB.C3=D.C3

4 REPLIES 4
parry2k
Super User
Super User

@sivashankr seems like A is your fact table and other 3 are dimension table, why not you load all 4 tables in the model and set relationship from A table with other 3 tables.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hello @parry2k 

Thanks for your replay.

Could you please let me know how to create the Left Outer Join in 'relationship' window as it has the cardinality 1-1, 1-M, M-1 and M-M?

Hi @sivashankr ,

 

A many-to-one relationship is the most common, default type of relationship. It means the column in a given table can have more than one instance of a value, and the other related table, often know as the lookup table, has only one instance of a value.

 

And you can refer the following articles.

Power BI – Seven Types of Table Joins

create-and-manage-relationships

Model relationships in Power BI

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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