DAX: Rolling 12-month turnover rate but trying to average monthly distinct counts

saltesc

New Member
Joined
Oct 11, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

I'm attempting to do a simple 12-month turnover rate:

Employee Separations / Avg Employee Headcount over 12 months

However, the dataset I have has employees appearing multiple times as they are split over multiple roles. Initially, to overcome this issue for getting my rolling headcount, I was able to create a measure using DISTINCTCOUNT() on employee IDs with Hire Date and Separation Date filters over my rolling 24-month report:

Code:
Active Headcount =
CALCULATE (
    DISTINCTCOUNT( EmpData[Unique ID] ),
    FILTER (
        ALLSELECTED ( EmpData ),
        EmpData[Hire date] < LASTDATE ( 'Calendar'[Dates] )
            && EmpData[Separation process month] > LASTDATE ( 'Calendar'[Dates] )
            || EmpData[Hire date] < LASTDATE ( 'Calendar'[Dates] )
                && ISBLANK ( EmpData[Separation process month] )
    )
)

This works fine, as I see the total headcount as of Year/Month/Day as I drill through. However, trying to get the rolling average of this is proving difficult. If I set up a Matrix in monthly view, it may be easier to understand...

avgturn.png


So, here's my headcount figures showing correctly with the aforementioned Measure. I need to get the average of the period (in red) rolling so that it updates each year, month, etc. in the reporting and allows me to calculate my annualised attrition (turnover) rate.

Any ideas much appreciated.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

pjmorris

Well-known Member
Joined
Aug 2, 2012
Messages
2,036
Office Version
  1. 2016
Platform
  1. Windows
In my models I frequently use a disconnected calendar and then apply the dates explicitly:
for example: =CALCULATE( DISTINCTCOUNT( EmpData[Unique ID] )/12,
FILTER (EmpData[Hire date] < LASTDATE ( 'Calendar'[Dates] && EmpData[Hire date] >= DATEADD("YY",-1, LASTDATE ( 'Calendar'[Dates] ))))

HTH
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,115
Messages
5,768,198
Members
425,459
Latest member
Danniey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top