Forum Discussion
Walt1010
Helper V
1 year agoSum everything within a date range (cumulatively)
Noob here. I have a table of dates, indicating dates on which employees took a sickness leave day. I need to calculate the sum of all the sickness leave days taken over the past 2 years, at any d...
- 1 year ago
Walt1010 , Try using
CumulativeSicknessLeave =
VAR CurrentDate = MAX(sicknesstable[sicknessdate])
RETURN
CALCULATE(
COUNT(sicknesstable[sicknessdate]),
FILTER(
ALL(sicknesstable),
sicknesstable[sicknessdate] <= CurrentDate &&
sicknesstable[sicknessdate] >= DATEADD(CurrentDate, -2, YEAR)
)
)
bhanu_gautam
Super User
1 year agoWalt1010 , Try using
CumulativeSicknessLeave =
VAR CurrentDate = MAX(sicknesstable[sicknessdate])
RETURN
CALCULATE(
COUNT(sicknesstable[sicknessdate]),
FILTER(
ALL(sicknesstable),
sicknesstable[sicknessdate] <= CurrentDate &&
sicknesstable[sicknessdate] >= DATEADD(CurrentDate, -2, YEAR)
)
)