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
tebtim19
Helper IV
Helper IV

HR Dashboard

This is my sample measure I used for # of terminations

Terminations =
CALCULATE(COUNT(Employees[EmpID]),USERELATIONSHIP(Employees[TermDate],'Dates'[Date]),NOT(ISBLANK(Employees[TermDate])))
 
 
But the problem is my for all permanent employee Termdate is set to 5555.12.31
So it's not blank at all, can someone help me how to count those who leave in the company filtered by year.
 
I made another table for dates:
Dates =
VAR MinYear = YEAR ( MIN (Employees[HireDate] ) )
VAR MaxYear = YEAR ( MAX (Employees[TermDate]) )
RETURN
ADDCOLUMNS (
FILTER (
CALENDARAUTO( ),
AND ( YEAR ( [Date] ) >= MinYear, YEAR ( [Date] ) <= MaxYear )
),
"Year", FORMAT([Date], "yyyy"),
--"Calendar Year", "CY " & YEAR ( [Date] ),
"Month Name", FORMAT ( [Date], "mmm" ),
"Month Number", MONTH ( [Date] ),
"Weekday", FORMAT ( [Date], "dddd" ),
"Weekday number", WEEKDAY( [Date] ),
"Year Month", FORMAT ([Date], "mmm yy"),
"Quarter", "Q" & TRUNC ( ( MONTH ( [Date] ) - 1 ) / 3 ) + 1
 
)
 
Not sure if the dates table that I added is correct.
I add also this date relationship to Hire date and TermDate
 
Anyone who have idea? 
 
 
 
 
 
 
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @tebtim19 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. Please note that there is no relationship be created between Employees and dates table...

Terminations = 
CALCULATE (
    DISTINCTCOUNT ( Employees[EmpID] ),
    FILTER (
        'Employees',
        NOT ( ISBLANK ( Employees[TermDate] ) )
            && 'Employees'[TermDate] <= SELECTEDVALUE ( 'Dates'[Date] )
    )
)

Terminations.JPG

Best Regards

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

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @tebtim19 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. Please note that there is no relationship be created between Employees and dates table...

Terminations = 
CALCULATE (
    DISTINCTCOUNT ( Employees[EmpID] ),
    FILTER (
        'Employees',
        NOT ( ISBLANK ( Employees[TermDate] ) )
            && 'Employees'[TermDate] <= SELECTEDVALUE ( 'Dates'[Date] )
    )
)

Terminations.JPG

Best Regards

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

@tebtim19 , Try measure like


Terminations =
CALCULATE(COUNT(Employees[EmpID]),USERELATIONSHIP(Employees[TermDate],'Dates'[Date]),Employees[TermDate] <date(5999,12,31))

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.