Forum Discussion
Running Total Help
MichelleRoberts Hi!
Try with:
RunningTotalDemand-HrsPWHrs =
VAR CurrentDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
SUMX(
FILTER(
ALL('Calendar'),
'Calendar'[Date] <= CurrentDate
),
IF(
[Demand] > 0 || 'Calendar'[Date] = CurrentDate,
[Demand-HoursPW],
0
)
)
)
If it's ok please accept my answer as solution, instead, paste me some sample data plis
BBF
It's still not calculating correctly. I exported the data to Excel so I could calculate it and compare the two. See below.
- BeaBF2 years agoSuper User
MichelleRoberts adjusted:
RunningTotalDemand-HrsPWHrs =
VAR CurrentDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
SUMX(
FILTER(
ALL('Calendar'),
'Calendar'[Date] <= CurrentDate
),
IF(
[Demand] > 0 || 'Calendar'[Date] = CurrentDate,
[Demand-HoursPW],
0
)
),
ALLEXCEPT('Calendar', 'Calendar'[Date])
)BBF
- MichelleRoberts2 years agoRegular Visitor
I now get this as a result:
- BeaBF2 years agoSuper User
MichelleRoberts can you paste the data? so that i can do copy paste into a power bi and do some tests.
meanwhile try with:
RunningTotalDemand-HrsPWHrs =
VAR CurrentDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
SUMX(
FILTER(
ALL('Calendar'),
'Calendar'[Date] <= CurrentDate
),
IF(
[Demand] > 0 || 'Calendar'[Date] = CurrentDate,
[Demand-HoursPW],
BLANK() -- Use BLANK() instead of 0 to avoid adding zero values
)
)
)BBF