Forum Discussion
MattRoed
6 years agoHelper I
Custom Column to Reverse a Running Total
I would like a column that can reverse a column that is keeping track of a running total. Trap DateCaptured Count Change 1000 1/1/2020 0 0 1000 1/8/2020 101 101 1000 1/15/2020...
- 6 years ago
Please try this expression your column
Change = VAR __thisvalue = Traps[Count] VAR __thisdate = Traps[DateCaptured] VAR __prevdate = CALCULATE ( MAX ( Traps[DateCaptured] ), ALLEXCEPT ( Traps, Traps[Trap] ), Traps[DateCaptured] < __thisdate ) VAR __prevvalue = CALCULATE ( MAX ( Traps[Count] ), ALLEXCEPT ( Traps, Traps[Trap] ), Traps[DateCaptured] = __prevdate ) RETURN __thisvalue - __prevvalueIf this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
MattRoed
6 years agoHelper I
amitchandak your new column worked initially, but I had to re import my dataset and now it seems to be out putting negative values. Any thoughts on how to fix this?