Forum Discussion
left join
- 6 years ago
Hi D_PBI ,
We can think about LEFT JOIN as a subset of CROSS JOIN result. In SQL such logic was used at start and only after we received separate syntax for LEFT and RIGHT JOINs. So based on this we can use a function GENERATEALL (similar to CROSS APPLY in SQL).
Here is an example of table showing join using DAX:
Table Example = GENERATEALL( 'Table1', VAR __Table1_Col1 = Table1[Col1] RETURN CALCULATETABLE('Table2', Table2[Col5] = __Table1_Col1 ) )Input tables:
Table1
Table2
Table result of an aforementioned formula
Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!
You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups
Hi D_PBI ,
We can think about LEFT JOIN as a subset of CROSS JOIN result. In SQL such logic was used at start and only after we received separate syntax for LEFT and RIGHT JOINs. So based on this we can use a function GENERATEALL (similar to CROSS APPLY in SQL).
Here is an example of table showing join using DAX:
Table Example =
GENERATEALL(
'Table1',
VAR __Table1_Col1 = Table1[Col1]
RETURN
CALCULATETABLE('Table2',
Table2[Col5] = __Table1_Col1
)
) Input tables:
Table1
Table2
Table result of an aforementioned formula
Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!
You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups