Forum Discussion
Running total in time
- Anonymous9 years ago
Here is my theory:
CumulativeHours =
VAR LastEvent = LASTNONBLANK ( Time[Week], CALCULATE ( SUM ( Events[HoursRound] ) ) )
RETURN
CALCULATE (
SUM ( Events[HoursRound] ),
FILTER ( ALL ( 'Time'[Week] ), 'Time'[Week] <= MAX ( 'Time'[Week] ) && 'Time'[Week] <= LastEvent)
)
Maybe try wrapping your running total in an IF() statement that checks if the date value is the current week or earlier and if yes, returns your cumulative value, and if not, returns BLANK().
An easy way to do this is to add a calc column that checks if the date is => current week and return a Yes or No flag, then use this field in your measure for the filter argument.
Also, you could try setting a visual level filter on the chart you have to only show dates up to the current date/week.
Here is my theory:
CumulativeHours =
VAR LastEvent = LASTNONBLANK ( Time[Week], CALCULATE ( SUM ( Events[HoursRound] ) ) )
RETURN
CALCULATE (
SUM ( Events[HoursRound] ),
FILTER ( ALL ( 'Time'[Week] ), 'Time'[Week] <= MAX ( 'Time'[Week] ) && 'Time'[Week] <= LastEvent)
)
- Marcin9 years ago
Helper V
That works, thanks a lot for help !