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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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
Back
Top