How to create a cumulative subtract down a column (Subtract Running Totals)

Knowledge Drop

Last tested: Mar 11, 2021
 

The Problem

 If I want to perform a cumulative subtracting with the current cumulative row value minus the next row value with table calculation?

Solution:

One options is to use the following

sum(offset_list(

if( row() = 1, ${users.average_age},-${users.average_age} )

,

1-row(),

row()

)

)

The outcome in the Explore UI will look like this:

Screen Shot 2021-03-11 at 18.46.54.png


As we use so many functions combined here, I would suggest to look them up in our docs here for more context.

This content is subject to limited support.                

Version history
Last update:
‎05-07-2021 09:48 AM
Updated by: