docs-v2/content/v2.0/reference/flux/stdlib/built-in/transformations/cumulativesum.md

1.1 KiB

title description aliases menu weight
cumulativeSum() function The `cumulativeSum()` function computes a running sum for non-null records in the table.
/v2.0/reference/flux/functions/transformations/cumulativesum
/v2.0/reference/flux/functions/built-in/transformations/cumulativesum/
v2_0_ref
name parent
cumulativeSum built-in-transformations
401

The cumulativeSum() function computes a running sum for non-null records in the table. The output table schema will be the same as the input table.

_Function type: Transformation
Output data type: Float

cumulativeSum(columns: ["_value"])

Parameters

columns

A list of columns on which to operate. Defaults to ["_value"].

Data type: Array of strings

Examples

from(bucket: "example-bucket")
  |> range(start: -5m)
  |> filter(fn: (r) =>
    r._measurement == "disk" and
    r._field == "used_percent"
  )
  |> cumulativeSum(columns: ["_value"])

CUMULATIVE_SUM()