7.6 Accumulate data in each group

 

There is a sales data table:

imagepng

To calculate the cumulative sales of each person, the code is as follows (calculate in cell D1):

=spl("=E(?1).new(cum(~~+Sales;Name):'Cumulative Sales')",A1:C22)

cum(x; Gi,…) is an iteration function, used in the loop function; x is an expression containing ~~; ~~ represents the cumulative value; Gi is an ordered column, and group by Gi and accumulate within the group.

imagepng