Forum Discussion
Headcount & turnover analysis
My numbers are not coming correct...headcount at the beginning of March should be the same as headcount at the end of February. But it's not the same.
I have used below formulas to solve the same
Headcount at the end of each month:
Hi Anonymous ,
To create a flexible headcount analysis which respects time dimension you only need two tables,
- An employee fact table
- A calendar table
For doing the correct headcount analysis, you need to set your calendar table as a disconnected table from your employee fact table. Hence I believe that you do not need to resort to crossfilter function in your calculation.
You just need the 3 pieces of information in your employee fact table, which I believe you already have.
- Employee ID
- Starting Date
- Leaving Date
To enable slicing of headcount by time-dimension at any point in time, we have to keep the calendar table and employee fact table as disconnected tables as mentioned above.
The DAX formula below provides a flexible headcount number at any historical point in time:
Headcount = SUMX ( EmployeeFact, IF ( EmployeeFact[Start] <= [SelectedDate] && EmployeeFact[End] >= [SelectedDate], 1, BLANK () ) )There's an article which discusses how to prepare headcount analysis in the following link.
https://p3adaptive.com/finding-the-magic-part-2-on-the-way-to-data-happiness/
I hope it will be of use.
Best regards,
1 Reply
- DataNinja777
Super User
Hi Anonymous ,
To create a flexible headcount analysis which respects time dimension you only need two tables,
- An employee fact table
- A calendar table
For doing the correct headcount analysis, you need to set your calendar table as a disconnected table from your employee fact table. Hence I believe that you do not need to resort to crossfilter function in your calculation.
You just need the 3 pieces of information in your employee fact table, which I believe you already have.
- Employee ID
- Starting Date
- Leaving Date
To enable slicing of headcount by time-dimension at any point in time, we have to keep the calendar table and employee fact table as disconnected tables as mentioned above.
The DAX formula below provides a flexible headcount number at any historical point in time:
Headcount = SUMX ( EmployeeFact, IF ( EmployeeFact[Start] <= [SelectedDate] && EmployeeFact[End] >= [SelectedDate], 1, BLANK () ) )There's an article which discusses how to prepare headcount analysis in the following link.
https://p3adaptive.com/finding-the-magic-part-2-on-the-way-to-data-happiness/
I hope it will be of use.
Best regards,