### Cumulative Sum

Returns the cumulative sum based on the currently applied sort order for each leaf nodes, any inner nodes return a null value.

Sample

Below is a
table showing Day and Amount fields, with Balance as the new aggregate
column (CumulativeSum) based on Amount as the **source** column
and Day as the **weight** column.

The Key column serves as the breakdown.

Key |
Day |
Amount |
Balance |

A |
5 |
$2.00 |
$5.50 |

B |
2 |
$3.00 |
$7.00 |

C |
7 |
-$1.00 |
$9.50 |

D |
3 |
-$5.00 |
$2.00 |

E |
1 |
$4.00 |
$4.00 |

F |
4 |
$1.50 |
$3.50 |

G |
6 |
$5.00 |
$10.50 |

H |
10 |
$1.00 |
$12.50 |

I |
8 |
-$2.00 |
$7.50 |

J |
9 |
$4.00 |
$11.50 |

In the example, you get one row in the visualization per row in the data source since every source row has a unique key. If not, multiple rows roll into each visualization row, and then the CumulativeSum will first sort them on the sums of the Day column, then accumulate the sums of the Amount column.

To get the
correct CumulativeSum values in the Balance column, click the **Up/Down**
button of the Day column to sort the fields in ascending order.

Result

Based on the ascending sort order of the Day column and the cumulative sum of the Amount column, the results will be:

Key |
Day |
Amount |
Balance |

E |
1 |
$4.00 |
$4.00 |

B |
2 |
$3.00 |
$7.00 |

D |
3 |
-$5.00 |
$2.00 |

F |
4 |
$1.50 |
$3.50 |

A |
5 |
$2.00 |
$5.50 |

G |
6 |
$5.00 |
$10.50 |

C |
7 |
-$1.00 |
$9.50 |

I |
8 |
-$2.00 |
$7.50 |

J |
9 |
$4.00 |
$11.50 |

H |
10 |
$1.00 |
$12.50 |

Computation details:

Day 1: $4.00 |
Day 6: $5.50 + $5.00 = $10.50 |

Day 2: $4.00.00 + $3.00 = $7.00 |
Day 7: $10.50 + -$1.00 = $9.50 |

Day 3: $7.00 + -$5.00 = $2.00 |
Day 8: $9.50 + -$2.00 = $7.50 |

Day 4: $2.00 + $1.50 = $3.50 |
Day 9: $7.50 + $4.00 = $11.50 |

Day 5: $3.50 + $2.00 = $5.50 |
Day 10: $11.50 + $1.00 = $12.50 |