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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
ibrewop23
Frequent Visitor

USERELATIONSHIP usage: One active and one inactive relationship in calculate measure

Hi - I am looking to understand if I need to be using 'USERELATIONSHIP' in my measure and if not, why not?

 

I am calcualting headcount as at the end of each calendar month. Here is my model:

ibrewop23_1-1678713602671.png

Active relationship: Leave Date and Date

Inactive relationship: Start Date and Date

 

Here is my measure:

 

Headcount End of Month = 
CALCULATE (
    DISTINCTCOUNT( 'Headcount'[Employee Code] ),
    'Headcount'[Start Date] <= MAX ( 'Date Table'[End of Month] )
        && (
            Headcount[Leave Date] > MAX ( 'Date Table'[End of Month] )
                || ISBLANK ( Headcount[Leave Date] )
        )
)

 If both relationships are inactive, I am aware that I do not need USERELATIONSHIP.

2 REPLIES 2
amitchandak
Super User
Super User

@ibrewop23 , Try like

 

Headcount End of Month =
CALCULATE (
Countx(Filter( 'Headcount',
'Headcount'[Start Date] <= MAX ( 'Date Table'[End of Month] )
&& (
Headcount[Leave Date] > MAX ( 'Date Table'[End of Month] )
|| ISBLANK ( Headcount[Leave Date] )
)
),'Headcount'[Employee Code] ), crossfilter('Date Table'[Date],'Headcount'[Leave Date], none) )

 

 

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks! appreciate you wrting back. 

 

Maybe I should have been clearer but I am looking to find out is an answer to this question specifically: 

 

I am looking to understand if I need to be using 'USERELATIONSHIP' in my measure and if not, why not?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors