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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.