CUMULATIVE_DIFFERENCE

The CUMULATIVE_DIFFERENCE function returns the difference between the current and previous values from an array of values.

The syntax for CUMULATIVE_DIFFERENCE is:

CUMULATIVE_DIFFERENCE( data , first value)

Parameters

data An array of values.
first value

Optional.
You have the option to:

  • Ignore first value (default): Ignores the first value and returns the first cumulative difference as the first value.
  • Use first value: Returns the first value in the data and then returns the cumulative difference from the first value.
  • Use zero: Returns zero as the first value.

Examples

CUMULATIVE_DIFFERENCE (ARRAY (5, 20, 30, 60 , 80), Use zero)

Results: 0 , 15 , 10 , 30 , 20

Using first value

CUMULATIVE_DIFFERENCE ( ARRAY (100 , 105 , 110 , 120), Ignore first value)

Results: 5 , 5 , 10

CUMULATIVE_DIFFERENCE ( ARRAY (100 , 105 , 110 , 120), Use zero)

Results: 0, 5 , 5 , 10

CUMULATIVE_DIFFERENCE ( ARRAY (100 , 105 , 110 , 120), Use first value)

Results: 100, 5 , 5 , 10

Related links: