Returns the cumulative sum of n according to the specified ordering. When a group is provided, the cumulative sum is computed within each group.
n: the numbers to cumulatively sum.
Examples
table T = with
[| as N, as G |]
[| 4, "b" |]
[| 3, "a" |]
[| 2, "a" |]
[| 1, "a" |]
T.A = cumsum(T.N) sort T.N
T.B = cumsum(T.N) by T.G sort T.N
show table "Cumulative sums" with
T.N
T.G
T.A
T.B
Output:
N
G
A
B
4
b
10
4
3
a
6
6
2
a
3
3
1
a
1
1
Remarks
This legacy helper predates scan. Prefer sum(T.N) scan T.N for new scripts.