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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

left join in tabular model

I Have a situation where cross join and left joins are involved.I want to implement the below query in tabular model.I have managed till cross join using Dax -Cross join (tableI,tableT) and joined all other table A,P,O,T but how to join the last two table(T,PH) which join on the result set of cross join (tableI,tableT)  based on two key column -TH.colI= Main.colI , TH.colT=d.colT .

Query need to be implemented in tabular model.

Easiest way is to implement using creation of views.

Select I*,A.*,P.*,O.*,T.*,d.colT,Th.colX,PH.ColPH from C WITH (NOLOCK)
LEFT JOIN I WITH (NOLOCK) ON C.colC= I.colI
LEFT JOIN A WITH (NOLOCK) ON I.colI = A.colA
LEFT JOIN P WITH (NOLOCK) ON I.colI = P.colP
LEFT JOIN O WITH (NOLOCK) ON I.colI = O.colO
LEFT JOIN T WITH (NOLOCK) ON T.colT= P.colP
and T.colT IN
( 'A','B','C')
cross join (SELECT DISTINCT colT FROM T WHERE colT IN
('A'
,'B'
,'C'
,'D'
,'E'
,'F'
))d

 

)Main

left JOIN T AS TH WITH (NOLOCK) ON TH.colI= Main.colI and TH.colT=d.colT
left join PH WITH (NOLOCK) ON PH.colI=Main.colI

 

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

Here I think we can use NATURALLEFTOUTERJOIN and CALCULATETABLE to work on it. Could you please share your sample data and excepted result to me, if you don't have confidential data? Please upload your file to One Drive and share the link here.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.