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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
pityman
Regular Visitor

Dax for Self Join Table

Hi,

How do i convert the following SQL to Dax?

select COUNT(*) from TDRep TDR , TDPSLink TDPSL where TDR.TDId = TDPSL.TDID AND TDR.ToStatus = '7' AND (TDPSL.StatusId != 12 OR TDPSL.StatusId != 10)

Thank you

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @pityman ,

 

Refer this measure.

 

Measure = CALCULATE(COUNT(TDRep[TDId]),FILTER(TDRep,TDRep[TDId] in VALUES(TDPSL[TDId])&&TDRep[ToStatus ]=7),FILTER(TDPSL,TDPSL[StatusId]<>12||TDPSL[StatusId]<>10))

 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @pityman ,

 

Refer this measure.

 

Measure = CALCULATE(COUNT(TDRep[TDId]),FILTER(TDRep,TDRep[TDId] in VALUES(TDPSL[TDId])&&TDRep[ToStatus ]=7),FILTER(TDPSL,TDPSL[StatusId]<>12||TDPSL[StatusId]<>10))

 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@pityman , Both tbale should have join in power bi on TDID, create a measure like

 

calculate(countrows(TDRep), filter(TDRep, TDRep[ToStatus] ="7"), filter(TDPSLink,TDPSLink[StatusId] <> 12 || TDPSLink[StatusId]<> 10))

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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