i have a dataset that looks like this:
amount rank category
4000 1 A
200 3 A
1000 2 A
10 4 A
500 1 B
...
I want to calculate the cumulative sum of amount
based on ordering of rank
, i.e. return:
cum rank category
4000 1 A
5000 2 A
5200 3 A
5210 4 A
...
any help would be nice! :)