cancel
Showing results for 
Search instead for 
Did you mean: 

Rolling Sum + Max Condition

nikhil_cr
Cosmonaut

Hi,

I'm trying to achieve a rolling sum with a max condition. Basically trying to do a rolling sum but before we roll the 1st row sum to the next row we have to check with a condition if the rolling value is less than or equal to Zero. If it is less than zero we have to make it as zero else we will roll the sum with the +ve value. Please see attached sample. Column in Green is something which we have to achieve.

Note: Please see comment in cell P11. Please provide a solution on the MV side as the calculation will be further used in other tables.

Appreciate your help

Thanks,

Nikhil

5 REPLIES 5

@JoeM : My bad, Its working. I made some mistake while reading the columns. 

FYI - one of our teammates found a solution using SQL - You can refer attached sql code.