Forum Discussion
Anonymous
3 years agoNot applicable
cummulative sum
Hi,
I have a table like below,
| YYYY-MM | Year | MonthNo | Funded Amt |
| 2021-11 | 2021 | 11 | 1000 |
| 2022-01 | 2022 | 1 | 2000 |
| 2022-02 | 2022 | 2 | |
| 2022-03 | 2022 | 3 | 1000 |
| 2022-04 | 2022 | 4 | 1000 |
| 2022-05 | 2022 | 5 | 1000 |
| 2022-06 | 2022 | 6 | 1000 |
| 2022-07 | 2022 | 7 | 1000 |
| 2022-08 | 2022 | 8 | 1000 |
| 2022-09 | 2022 | 9 | 1000 |
| 2022-10 | 2022 | 10 | 1000 |
| 2022-11 | 2022 | 11 | 1000 |
| 2022-12 | 2022 | 12 | 1000 |
| 2023-01 | 2023 | 1 | 3000 |
| 2023-02 | 2023 | 2 | 2000 |
| 2023-03 | 2023 | 3 | 1000 |
I want to calculate 2 cummulative columns on funded amount, one is year wise and the other is general cummulation like below,
| YYYY-MM | Year | MonthNo | Funded Amt | Year Wise Cummulative Sum | total Cummulative |
| 2021-11 | 2021 | 11 | 1000 | 1000 | 1000 |
| 2022-01 | 2022 | 1 | 2000 | 2000 | 3000 |
| 2022-02 | 2022 | 2 | 2000 | 3000 | |
| 2022-03 | 2022 | 3 | 1000 | 3000 | 4000 |
| 2022-04 | 2022 | 4 | 1000 | 4000 | 5000 |
| 2022-05 | 2022 | 5 | 1000 | 5000 | 6000 |
| 2022-06 | 2022 | 6 | 1000 | 6000 | 7000 |
| 2022-07 | 2022 | 7 | 1000 | 7000 | 8000 |
| 2022-08 | 2022 | 8 | 1000 | 8000 | 9000 |
| 2022-09 | 2022 | 9 | 1000 | 9000 | 10000 |
| 2022-10 | 2022 | 10 | 1000 | 10000 | 11000 |
| 2022-11 | 2022 | 11 | 1000 | 11000 | 12000 |
| 2022-12 | 2022 | 12 | 1000 | 12000 | 13000 |
| 2023-01 | 2023 | 1 | 3000 | 3000 | 16000 |
| 2023-02 | 2023 | 2 | 2000 | 5000 | 18000 |
| 2023-03 | 2023 | 3 | 1000 | 1000 | 19000 |
the year wise cummulative sum - cummulates the funded amt column for every month in a year.
In 2021, the value is 1000 since it the only value available for month 11
In 2022, for month 1 its 2000, for month 2, 2000(2000+0), for month 3 its 3000 (2000 + 0 + 1000) and so on...
In 2023, for month 1, it will be considered fresh , for month 1 its 3000, for month 2 its 5000(2000+3000)
total cummulative is the running total based on every month in a year.
Please help!
2 Replies
- Ashish_Mathur
Super User