I have one table. It contains a history of interest accrued per month and possible cash payments to cover the interest accrued up to a point.
For example:
DATE | DESCRIPTION | AMOUNT |
---|---|---|
2/2/2024 | Interest | 3000 |
3/2/2024 | Interest | 7000 |
3/14/2024 | Cash paid | 9000 |
4/2/2024 | Interest | 4000 |
5/2/2024 | Interest | 1000 |
5/13/2024 | Cash paid | 20000 |
6/2/2024 | Interest | 3000 |
I want to do a running total that will reset to zero when the cash paid is greater than the running total on that date. If the cash paid is less than the running total, it should continue the running total and not reset.
In the table above, the running total will not reset on March 14 because the cash paid is less than the accrued interest of 10000, but will reset on the 13th of May to zero because the cumulative interest of 15000 is less than the total cash paid of 24000.
The result should look something like this:
Desc | running total | DATE |
---|---|---|
Interest | 15000 | 5/13/2024 |
Interest | 3000 | 6/2/2024 |
1