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
No problem, I know your asking so you can help me correctly. Really means alot.
Yes, it will be in the same row in "000" but in a diffrent column.
So its like a car rental company. I need to know how many Cars are needed per hour based on cutsomer reservations. so if I have 10 customers at 0100, I need 10 Cars. if at 0200 I have another 10 customers that need 10 cars then the requirment by 0200 is 20 cars. But if at 0200 I have 5 customers that return thier cars then I actually only need 15 cars now because someone who had the cars previoulsy have returned it so the total 20 cars are not needed anymore. It only subtracts when TRUCKS are availble (I should actual name that column retuned sorry) - hope this makes more sense
Please try
RunningTotal =
VAR T =
ALL ( 'All Web Site Data (2)' )
VAR FirstRecord =
TOPN ( 1, T, 'All Web Site Data (2)'[Date], ASC )
VAR InService =
MAXX ( FirstRecod, '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
Thank you so much, I will try now. Is that one measure for both? Wouldn't i need two sepreate calculations? One for each yellow column ?