docs-v2/content/flux/v0.x/stdlib/universe/sum.md

1.6 KiB
Raw Permalink Blame History

title description aliases menu weight flux/v0.x/tags related introduced
sum() function The `sum()` function computes the sum of non-null records in a specified column.
/influxdb/v2.0/reference/flux/functions/transformations/aggregates/sum
/influxdb/v2.0/reference/flux/functions/built-in/transformations/aggregates/sum/
/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/sum/
/influxdb/cloud/reference/flux/stdlib/built-in/transformations/aggregates/sum/
flux_0_x_ref
name parent
sum universe
102
aggregates
transformations
/{{< latest "influxdb" "v1" >}}/query_language/functions/#sum, InfluxQL SUM()
/flux/v0.x/stdlib/experimental/sum
0.7.0

The sum() function computes the sum of non-null records in a specified column. sum() is an aggregate function.

sum(column: "_value")

Parameters

column

The column on which to operate. Default is "_value".

tables

Input data. Default is piped-forward data (<-).

Examples

{{% flux/sample-example-intro %}}

import "sampledata"

sampledata.int()
    |> sum()

{{< expand-wrapper >}} {{% expand "View input and output" %}} {{< flex >}} {{% flex-content %}}

Input data

{{% flux/sample "int" %}}

{{% /flex-content %}} {{% flex-content %}}

Output data
tag _value
t1 51
tag _value
t2 53
{{% /flex-content %}}
{{< /flex >}}
{{% /expand %}}
{{< /expand-wrapper >}}