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

View all the Fabric Data Days sessions on demand. View schedule

Reply
TomTomTom
Helper II
Helper II

Calculating Turnover Rate in DAX ( But: Using Average Employed Per Day )

I would like to calculate staff turnover rate in DAX, but the formula we are using is slightly different to the cases I've seen online:

 

Leavers in given period of time

divided by

Average headcount in same period of time

 

It is the average headcount I am struggling with: most examples take headcount at end of period, or the average of headcount at start and end, but not the actual average per day headcount in a period.

 

I can do this in Power Query but we need end users to dynamically interact with the data - filter by Department, date ranges, etc.

 

The data is as you'd expect - a fact table of employee IDs with from and to dates plus a few details.

 

Dummy data including (currently botched attempts at) measures:

 

https://1drv.ms/u/s!AmzInrHWVr2zgYU0akVhd-ilLdCp-A

 

thanks for any help !

1 ACCEPTED SOLUTION
TomTomTom
Helper II
Helper II

Thank you both for your ideas.

 

I am fairly sure I have cracked it with these three measures (the names are with the real data set, not the dummy one):

Leavers =

VAR MaxDate = Max ( Date_Table[Date] )
VAR MinDate = Min ( Date_Table[Date] )

RETURN
0 +
CALCULATE (
COUNTROWS(Raw_Data),
Raw_Data[To] <= MaxDate,
Raw_Data[To] >= MinDate,
All(Date_Table)
)
 
 
 
 
Headcount =

VAR MaxDate = Max ( Date_Table[Date] )
VAR MinDate = Min ( Date_Table[Date] )

RETURN
0 +
CALCULATE (
COUNTROWS(Raw_Data),
Raw_Data[From] <= MaxDate,
Raw_Data[To] >= MinDate || ISBLANK(Raw_Data[To]),
All(Date_Table)
)
 
 
 
 
Av_Turnver =

VAR MaxDate = Max(Date_Table[Date])
VAR MinDate = Min(Date_Table[Date])
VAR DayCount = 1 + (MaxDate - MinDate)

RETURN

DIVIDE (
[Leavers] * DayCount,
SUMX(Date_Table, [Headcount]),
0
)
 
 
 

View solution in original post

5 REPLIES 5
v-deddai1-msft
Community Support
Community Support

Hi @TomTomTom ,

 

I'm glad that you have solved the issue by yourself and  share it with us. Would you please consider Accept helpful reply as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

TomTomTom
Helper II
Helper II

Thank you both for your ideas.

 

I am fairly sure I have cracked it with these three measures (the names are with the real data set, not the dummy one):

Leavers =

VAR MaxDate = Max ( Date_Table[Date] )
VAR MinDate = Min ( Date_Table[Date] )

RETURN
0 +
CALCULATE (
COUNTROWS(Raw_Data),
Raw_Data[To] <= MaxDate,
Raw_Data[To] >= MinDate,
All(Date_Table)
)
 
 
 
 
Headcount =

VAR MaxDate = Max ( Date_Table[Date] )
VAR MinDate = Min ( Date_Table[Date] )

RETURN
0 +
CALCULATE (
COUNTROWS(Raw_Data),
Raw_Data[From] <= MaxDate,
Raw_Data[To] >= MinDate || ISBLANK(Raw_Data[To]),
All(Date_Table)
)
 
 
 
 
Av_Turnver =

VAR MaxDate = Max(Date_Table[Date])
VAR MinDate = Min(Date_Table[Date])
VAR DayCount = 1 + (MaxDate - MinDate)

RETURN

DIVIDE (
[Leavers] * DayCount,
SUMX(Date_Table, [Headcount]),
0
)
 
 
 
amitchandak
Super User
Super User

@TomTomTom , At the first look at data, seems like it this blog should help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

https://www.youtube.com/watch?v=e6Y-l_JtCq4

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
mahoneypat
Microsoft Employee
Microsoft Employee

Please try these two measure expressions.  Use the 2nd one in your visual with Year and Month columns.

 

Turnover =
VAR MaxDate =
    MAX ( Calendar[Date] )
VAR MinDate =
    MIN ( Calendar[Date] )
VAR vCurrent =
    CALCULATE (
        COUNTROWS ( Employee_Fact ),
        ALL ( 'Calendar'[Date] ),
        Employee_Fact[First_Day] <= MaxDate,
        Employee_Fact[Last_Day] >= MinDate
    )
VAR vCurrentEmployees =
    DISTINCT ( Employee_Fact[Employee_ID] )
VAR vPrevMonthEmployees =
    CALCULATETABLE (
        DISTINCT ( Employee_Fact[Employee_ID] ),
        PREVIOUSMONTH ( 'Calendar'[Date] )
    )
VAR vLeavers =
    COUNTROWS (
        EXCEPT (
            vPrevMonthEmployees,
            vCurrentEmployees
        )
    )
RETURN
    DIVIDE (
        vLeavers,
        vCurrent
    )
Avg Monthly Turnover =
AVERAGEX (
    SUMMARIZE (
        'Calendar',
        'Calendar'[Year],
        'Calendar'[Month]
    ),
    [Turnover]
)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks Pat.

 

Possibly I am missing something, but I don't think this gives me average employees in a given period.

 

For instance, if we employed:

 

Day 1 - 1 employee       (doesn't leave)

Day 2 - 997 employees  (996 all leave)

Day 3 - 1 employee       (same as day 1 employee)

 

then our average employee in this period is 333 and so our turnover is 996/333.

 

Or have I misunderstood?

 

thanks,

Tom

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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