Forum Discussion
Calculate employee turnover
- 7 years ago
Hello Anonymous
Take a look at the attached file. I think the measure will return what you are looking for.
Turnover = VAR FirstOfYear = STARTOFYEAR ( Dates[Date] ) VAR LastOfYear = ENDOFYEAR ( Dates[Date] ) VAR JanFirstHC = CALCULATE( COUNTROWS(employees), FILTER ( employees, employees[start_date] <= FirstOfYear && ( employees[end_date] > FirstOfYear || ISBLANK(employees[end_date]) ) ) ) VAR NewHires = CALCULATE( COUNTROWS( employees), employees[start_date] >= FirstOfYear && employees[start_date] <= LastOfYear ) VAR Leavers = CALCULATE( COUNTROWS( employees), employees[end_date] >= FirstOfYear && employees[end_date] <= LastOfYear ) VAR AnnualTurnover = ((Leavers + NewHires)/2) / JanFirstHC RETURN FORMAT(AnnualTurnover,"PERCENT")
I put each variable from above into it's own mesure just so you could see what it is calculating.
Hello Anonymous
Take a look at the attached file. I think the measure will return what you are looking for.
Turnover = VAR FirstOfYear = STARTOFYEAR ( Dates[Date] ) VAR LastOfYear = ENDOFYEAR ( Dates[Date] ) VAR JanFirstHC = CALCULATE( COUNTROWS(employees), FILTER ( employees, employees[start_date] <= FirstOfYear && ( employees[end_date] > FirstOfYear || ISBLANK(employees[end_date]) ) ) ) VAR NewHires = CALCULATE( COUNTROWS( employees), employees[start_date] >= FirstOfYear && employees[start_date] <= LastOfYear ) VAR Leavers = CALCULATE( COUNTROWS( employees), employees[end_date] >= FirstOfYear && employees[end_date] <= LastOfYear ) VAR AnnualTurnover = ((Leavers + NewHires)/2) / JanFirstHC RETURN FORMAT(AnnualTurnover,"PERCENT")
I put each variable from above into it's own mesure just so you could see what it is calculating.
- Anonymous7 years agoNot applicable
Thank you jdbuchanan71 it worked perfectly,
however there is only one issue, when i added the 6 measures and saved closed the report, i coulnd't open it this morning, it says file corrupted impossible to open, luckily i have it published online, i will repeat all the steps and try again.
- Anonymous7 years agoNot applicable
there is also a little issue with the turnover calculations : it's supposed to be new hires + Leavers but since Leavers is negative its calculation is wrong, i think in the formula we should write -Leavers instead of +leavers so the - can turn into a +
- jdbuchanan717 years ago
Super User
Anonymous
Yeah, I wasn't sure which way you wanted those to sum, sounds like you got it the way you need now. You only need to add the one big measure. I just added the others so you could see the numbers. They might be useful to have though.
- Anonymous7 years agoNot applicable
Thanks, i just want to add for the other users that will see the post, to have the correct turnover formula to work in a double axis as a percentage, Leave it at "Return AnnuelTurnover" without the "percentage" format then go to model and change the format to percentage, you also need to delete the - in the leavers formula