TIBCO Cloud™ Spotfire® Web Client User Guide

Cumulative Sum

A Cumulative Sum, or running total, displays the total sum of data as it grows with time, or with any other series of data. The total contribution so far of a given measure is calculated for each item (slice) in the visualization.

Example

As starting point, the bar chart below is used. It shows the quarterly sums of sales for three years.



In the next bar chart, the shortcut expression Cumulative Sum has been applied on the Value axis. (The arrow points to a bar used to explain what is calculated in the expression further down.)



The following expression is used on the Value axis:

Sum([Sales]) THEN Sum([Value]) OVER (AllPrevious([Axis.X]))

The first part of the expression specifies that the column [Sales] should be aggregated as a sum. The result of this part goes into the [Value] column to be used in the expression following THEN. For each node in the visualization (in this case each bar), the last part of the expression sums the current node and all previous nodes.

For example, calculation of the Cumulative Sum for Q1, 2020 (see the arrow in the previous image):

$2350 = $400 + $200 + $500 + $600 + $650 (the sum of the bars in the rectangle below).



See also AllPrevious().

The column selector in expanded mode

In the installed client, the extended column selector offers controls that make it easy to change various parameters in the expression shortcut:



Display name Optionally, specify a different display name instead of the default "Cumulative Sum ([Column Name])".
Axis Specify the axis over which to calculate the nodes.

Only categorical axes that perform some kind of grouping can show up in the drop-down list. This means that if you only have a grouping on the X-axis, then this is the only axis available, whereas if you also have colored by a categorical column then the Color axis will be available as well, and so on.