Forum Discussion
LasseLJørgensen
2 years agoRegular Visitor
Running total using datediff in a measure
I need a dynamic measure that can make a running total summing the amount of days between two dates per employee. I want the measure to be able to run in 12 months 'windows'. Please regard I am not ...
- 2 years ago
Anonymous
Hi, thx for the advice, but I couldn't get your idea to work.
I've worked on it some more and got it to work with this:Measure =VAR max_dato = MAX('Data'[Date paid])VAR min_dato = FIRSTDATE(SAMEPERIODLASTYEAR('Data'[Date paid]))RETURNCALCULATE(SUM('Data'[DIFF]),FILTER(ALL('Data'),'Data'[Date paid] <= max_dato&& 'Data'[Date incurred] >= min_dato))
LasseLJørgensen
2 years agoRegular Visitor
Anonymous
Hi, thx for the advice, but I couldn't get your idea to work.
I've worked on it some more and got it to work with this:
Measure =
VAR max_dato = MAX('Data'[Date paid])
VAR min_dato = FIRSTDATE(SAMEPERIODLASTYEAR('Data'[Date paid]))
RETURN
CALCULATE(SUM('Data'[DIFF]),
FILTER(ALL('Data'),
'Data'[Date paid] <= max_dato
&& 'Data'[Date incurred] >= min_dato)
)