Forum Discussion
setis
6 years agoPost Partisan
Calculating sick days
Dear experts,
I am trying to calculate the number of sick days per month.
The challenge is that there are instances where an employee has 2 lines per day (due to the shift distribution) like this:
| WorkDay | Salary ID | Timesheet | WorkTimeStart | WorkTimeEnd |
| 31-12-2019 | 1234 | Illness | 31-12-2019 06:30 | 31-12-2019 09:00 |
| 31-12-2019 | 1234 | Illness | 31-12-2019 13:00 | 31-12-2019 15:30 |
| 30-12-2019 | 1234 | Normal | 30-12-2019 06:30 | 30-12-2019 15:30 |
| 30-12-2019 | 1935 | Normal | 30-12-2019 06:30 | 30-12-2019 09:00 |
I would like to count the Sick days, not the sick shifts, it that makes sense.. The desired result for this would be 1.
I've tried using DISTINCTCOUNT but this gives me the number of different employees that has been sick during the chosen period.
How should I proceed?
Thanks in advance!
7 Replies
- az38Community Champion
- Tahreem24Super User
setis ,
You can simply create a Measure like Below:
SickDay = CALCULATE(DISTINCTCOUNT(File[Timesheet]),File[Timesheet]="Illness")It will give you 1 as result. For your reference I have replicated your data and problem at my side and got the 1 result for SickDay.Don't forget to hit THUMBS UP and mark it as a solution if it helps you!