Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

cummulative sum

Hi,

 

I have a table like below,

 

YYYY-MMYearMonthNoFunded Amt
2021-112021111000
2022-01202212000
2022-0220222 
2022-03202231000
2022-04202241000
2022-05202251000
2022-06202261000
2022-07202271000
2022-08202281000
2022-09202291000
2022-102022101000
2022-112022111000
2022-122022121000
2023-01202313000
2023-02202322000
2023-03202331000

 

I want to calculate 2 cummulative columns on funded amount, one is year wise and the other is general cummulation like below,

 

YYYY-MMYearMonthNoFunded AmtYear Wise Cummulative Sumtotal Cummulative
2021-11202111100010001000
2022-0120221200020003000
2022-0220222 20003000
2022-0320223100030004000
2022-0420224100040005000
2022-0520225100050006000
2022-0620226100060007000
2022-0720227100070008000
2022-0820228100080009000
2022-09202291000900010000
2022-1020221010001000011000
2022-1120221110001100012000
2022-1220221210001200013000
2023-01202313000300016000
2023-02202322000500018000
2023-03202331000100019000

 

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!

Ashish_Mathur