Forum Discussion
Percentages based Overall Average Headcount By Division
Hi,
I'm trying to get the percentage of those who have been off sick in each Division against the average headcount population for each Division as below.
| Division | Avg Headcount | No. of Employees STS Sick | STS % |
| Division 1 | 754 | 243 | 32% |
| Division 2 | 2472 | 196 | 8% |
| Division 3 | 207 | 110 | 53% |
| Division 4 | 211 | 94 | 44 |
| Division 5 | 1750 | 518 | 30% |
| Division 6 | 600 | 116 | 19% |
| Division 7 | 1478 | 377 | 26% |
| Division 8 | 2581 | 610 | 24% |
| Grand Total | 10054 | 2256 | 22% |
*STS = ShortTerm Sick
I've added my measures into a Table visual and the Avg. Headcount figure changes when I select the Business Worker Type (Field/Staff) slicer, where as I need Avg. Headcount to remain as the overall headcount as above.
My measures are as follows:
- Anonymous3 years ago
Managed to solve this via YT video and adapt the DAX to my model. Video link as below.
Rolling 12Mth Avg. Headcountv2 = VAR Roll12MthHeadcount = [Rolling 12Mth Avg. Headcount] VAR IgnoreBWT = CALCULATE( [Rolling 12Mth Avg. Headcount], REMOVEFILTERS('BusinessWorkerType Lkp'[BusinessWorkerType]) ) RETURN IgnoreBWTSTS Emp.% = VAR Roll12MthAvgHC = [Rolling 12Mth Avg. Headcount] Var STSSickEmp = [Total STS Employees] VAR IgnoreBWT = CALCULATE([Rolling 12Mth Avg. Headcount], REMOVEFILTERS('BusinessWorkerType Lkp'[BusinessWorkerType]) ) VAR STSSick = DIVIDE(STSSickEmp, IgnoreBWT) RETURN STSSickhttps://www.youtube.com/watch?v=So6vr3mTHsA&list=PL52omI55z64GpBR9U-0cNp0UBSRt3qfU3&index=33&t=41s
2 Replies
- sturlaws
Resident Rockstar
Hi, Anonymous,
How to Get Your Question Answered Quickly
Since you have not posted any data, image of your data model or a pbix-file, I can only point you in the general direction:
Rolling 12Mth Avg. Headcount = VAR v_dates = DATESINPERIOD(Dates[Date], MAX(Dates[Date]), -12, MONTH) RETURN AVERAGEX(v_dates,calculate([Headcount],all('Business Worker Type Table'))but this will depend on your modelling.
If this post helps, then please consider Accepting it as the solution. Kudos are nice too. - AnonymousNot applicable
Managed to solve this via YT video and adapt the DAX to my model. Video link as below.
Rolling 12Mth Avg. Headcountv2 = VAR Roll12MthHeadcount = [Rolling 12Mth Avg. Headcount] VAR IgnoreBWT = CALCULATE( [Rolling 12Mth Avg. Headcount], REMOVEFILTERS('BusinessWorkerType Lkp'[BusinessWorkerType]) ) RETURN IgnoreBWTSTS Emp.% = VAR Roll12MthAvgHC = [Rolling 12Mth Avg. Headcount] Var STSSickEmp = [Total STS Employees] VAR IgnoreBWT = CALCULATE([Rolling 12Mth Avg. Headcount], REMOVEFILTERS('BusinessWorkerType Lkp'[BusinessWorkerType]) ) VAR STSSick = DIVIDE(STSSickEmp, IgnoreBWT) RETURN STSSickhttps://www.youtube.com/watch?v=So6vr3mTHsA&list=PL52omI55z64GpBR9U-0cNp0UBSRt3qfU3&index=33&t=41s