Berserk Docs
Scalar FunctionsOther Functions

row_cumsum

Calculates the cumulative sum of a column in a serialized row set. An optional restart argument resets the running sum to the current row's value when true. A row set is serialized by the sort, top, top-hitters, or serialize operators; order-preserving operators (extend, project, where, ...) keep that property. Only valid in a serialized context.

Syntax

row_cumsum(term, restart)

Parameters

Prop

Type

Returns: long

Examples

Example 1

datatable(value:long)[
  10,
  20,
  30
]
| sort by value asc
| extend running = row_cumsum(value)
value (long)running (long)
1010
2030
3060

On this page