Forum Discussion
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
- parry2kSuper 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.
- sivashankrHelper II
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?
- v-zhenbw-msftCommunity Support
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.