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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

USERELATIONSHIP with Filter

Hey all, 


I'm having trouble determining why my DAX doesn't return the correct answer.


The active relationship is  Calendar[Calendar Date] -> Service Agreement[Agreement Start Date Local]

However there is another column on the Service Agreement table, [Agreement End Date Local] which I'm trying to switch to when getting the row count for this measure.

I'm testing one user who has the following start and end dates:
tempsnip.png

 

CALCULATE(
DISTINCTCOUNT('Service Agreement'[Service Agreement Sk]),
USERELATIONSHIP(Calendar[Calendar Date], 'Service Agreement'[Agreement End Date Local]),
FILTER(
'Service Agreement',
'Service Agreement'[Agreement End Date Local] <= [End of Current Month] &&
'Service Agreement'[Agreement Event Type Sk] = 5
)
)
End of Current Month = EOMONTH(TODAY(), 0)


Why doesn't my formula return the correct date?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Well, I'm dumb...
All I needed to do was drop the USERELATIONSHIP within the measure and then reference it within another measure

Expired = 
CALCULATE(
DISTINCTCOUNT('Service Agreement'[Service Agreement Sk]),
FILTER(
'Service Agreement',
'Service Agreement'[Agreement End Date Local] <= [End of Current Month] &&
'Service Agreement'[Agreement Event Type Sk] = 5
)
)

 

CALCULATE( [Expired],
USERELATIONSHIP('Service Agreement'[Agreement End Date Local], Calendar[Calendar Date])
)

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Well, I'm dumb...
All I needed to do was drop the USERELATIONSHIP within the measure and then reference it within another measure

Expired = 
CALCULATE(
DISTINCTCOUNT('Service Agreement'[Service Agreement Sk]),
FILTER(
'Service Agreement',
'Service Agreement'[Agreement End Date Local] <= [End of Current Month] &&
'Service Agreement'[Agreement Event Type Sk] = 5
)
)

 

CALCULATE( [Expired],
USERELATIONSHIP('Service Agreement'[Agreement End Date Local], Calendar[Calendar Date])
)

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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