Forum Discussion
alex9999
Helper I
4 years agoCumulative Total by hour
I've checked most of the forum posts regarding cumulative and running totals but none of them seem to be working with my report. Date In/Out Tonnage 1/04/2022 In 345 1/04/2022 Out ...
- 4 years ago
alex9999
Please check the attached file:Running Total = VAR __Date = max( Dates[Date]) VAR __InTotal = CALCULATE( SUM(Table1[Tonnage]), Table1[In/Out] = "IN", 'Dates'[Date] <= __Date, ALLSELECTED( 'Dates' ) ) VAR __OutTotal = CALCULATE( SUM(Table1[Tonnage]), Table1[In/Out] = "OUT", 'Dates'[Date] <= __Date, ALLSELECTED( 'Dates' ) ) RETURN IF( sum(Table1[Tonnage]) <> BLANK(), __InTotal - __OutTotal )
Fowmy
Super User
4 years agoalex9999
Please check the attached file:
Running Total =
VAR __Date = max( Dates[Date])
VAR __InTotal =
CALCULATE(
SUM(Table1[Tonnage]),
Table1[In/Out] = "IN",
'Dates'[Date] <= __Date,
ALLSELECTED( 'Dates' )
)
VAR __OutTotal =
CALCULATE(
SUM(Table1[Tonnage]),
Table1[In/Out] = "OUT",
'Dates'[Date] <= __Date,
ALLSELECTED( 'Dates' )
)
RETURN
IF( sum(Table1[Tonnage]) <> BLANK(),
__InTotal - __OutTotal
)
alex9999
Helper I
4 years agoThank you, exactly what I was looking for! Great help š