Link Search Menu Expand Document


Returns an array of partial sums of elements from the source array (a cumulative sum). If the parameter <function> is provided, the values of the array elements are converted by this function before summing.


ARRAY_CUMULATIVE_SUM( [<function>,] array)
Parameter Description Supported input types
<function> The function used to convert the array members. Any function that can convert an array
<array> The array used for the sum calculations. Any array of numeric values

Return Type

ARRAY of the same type as the input array (must be numeric)


The following example adds 1 to each level in the levels array:

	ARRAY_CUMULATIVE_SUM(x -> x + 1, [ 1, 2, 3, 9 ]) AS levels;

Returns: 2,5,9,19