Forum Discussion

RobBeijers312's avatar
1 year ago
Solved

Events in progress with datediff

Hi,

 

For a report on sick days I need to calculate the datediff between startdate and enddate. If the enddate is 1-1-2100 the enddate is today. While this is no problem I cant get it to work if I need to use it per period. For example, employeeid 8 has 162 sick days till today. 86 of them are in 2024 and 76 are in 2025. Can anyone help me with this measure?

This is the current measure:

Aantal dagen ziek =
VAR mindatum = IF(MIN(Dimdatum[Date]) <= MAX(Ziekmeldingen[startdate]),MAX(Ziekmeldingen[startdate]),MIN(Dimdatum[Date]))
VAR maxdatum = IF(MAX(Ziekmeldingen[enddate]) <= MAX(Dimdatum[Date]),MAX(Ziekmeldingen[enddate]),MAX(Dimdatum[Date]))
VAR aantaldagenziek = CALCULATE(DATEDIFF(mindatum,maxdatum,DAY),REMOVEFILTERS(Dimdatum),Ziekmeldingen[startdate] <= maxdatum,Ziekmeldingen[enddate] >= mindatum)

 

5 Replies