I have a table like this :
Date | Amount |
---|---|
06/Jan/2021 | 300 |
05/Jan/2021 | 200 |
04/Jan/2021 | -100 |
03/Jan/2021 | -500 |
02/Jan/2021 | 200 |
01/Jan/2021 | 100 |
I want to get a column with the running totals but keeping the min amount to 0. The total resets to 0 once its below 0.
the expected outcome is as below
Date | Amount | Total |
---|---|---|
06/Jan/2021 | 300 | 500 |
05/Jan/2021 | 200 | 200 |
04/Jan/2021 | -100 | 0 |
03/Jan/2021 | -500 | 0 |
02/Jan/2021 | 200 | 200 |
01/Jan/2021 | 100 | 100 |