Forum Discussion
Add and subtract from Running total
- 3 years ago
Try
Calculation = VAR T = ALL ( 'All Web Site Data (2)' ) VAR T1 = TOPN ( 4, T, 'All Web Site Data (2)'[TIMES], ASC ) VAR StartTime = MAXX ( T1, 'All Web Site Data (2)'[TIMES] ) VAR InService = MAXX ( T, 'All Web Site Data (2)'[EBS IN SERVICE] ) VAR Result = SUMX ( FILTER ( T, 'All Web Site Data (2)'[Date] <= MAX ( 'All Web Site Data (2)'[Date] ) ), IF ( 'All Web Site Data (2)'[TIMES] > StartTime, 'All Web Site Data (2)'[Column1] - 'All Web Site Data (2)'[Column2] ) ) RETURN InService - Result
Can you share a screenshot showing the column that contains the starting value?
- tamerj13 years ago
Community Champion
Please try
RunningTotal =
VAR T =
ALL ( 'All Web Site Data (2)' )
VAR InService =
MAXX ( T, 'All Web Site Data (2)'[EBS IN SERVICE] )
VAR Result =
SUMX (
FILTER (
T,
'All Web Site Data (2)'[Date] <= MAX ( 'All Web Site Data (2)'[Date] )
),
'All Web Site Data (2)'[Column1] - 'All Web Site Data (2)'[Column2]
)
RETURN
InService + Result - Zidane223 years ago
Helper II
Not sure.. it jumps to the 100's which dosen't make sense, should be counting down as they day goes on not counting up...
- tamerj13 years ago
Community Champion
Zidane22
Noted. Please tryRunningTotal = VAR T = ALL ( 'All Web Site Data (2)' ) VAR InService = MAXX ( T, 'All Web Site Data (2)'[EBS IN SERVICE] ) VAR Result = SUMX ( FILTER ( T, 'All Web Site Data (2)'[Date] <= MAX ( 'All Web Site Data (2)'[Date] ) ), 'All Web Site Data (2)'[Column1] - 'All Web Site Data (2)'[Column2] ) RETURN InService - Result - Zidane223 years ago
Helper II
So if you look at the table above, the first item is 90 (not sure why there is a zero) but the value 90 updates through powerautomate depending whats in service. So if we only have 90 trucks in service we go over this, it should go into the negtives and not to 100's. Like the number will always be beloew the 90 or what ever value is there . so starting number of this forumla should start at 90 then gose down as the day goes because we are actually using trucks, if it goes into the minus means we are short then by the end of the day the number should go back up with all the returns