docs-v2/content/flux/v0.x/stdlib/experimental/count.md

1.8 KiB
Raw Permalink Blame History

title description menu weight aliases related flux/v0.x/tags introduced
experimental.count() function The `experimental.count()` function outputs the number of records in each input table and returns the count in the `_value` column.
flux_0_x_ref
name parent
experimental.count experimental
302
/influxdb/v2.0/reference/flux/stdlib/experimental/count/
/influxdb/cloud/reference/flux/stdlib/experimental/count/
/flux/v0.x/stdlib/universe/count/
/{{< latest "influxdb" "v1" >}}/query_language/functions/#count, InfluxQL COUNT()
transformations
aggregates
0.107.0

The experimental.count() function outputs the number of records in each input table and returns the count in the _value column. This function counts both null and non-null records. experimental.count() is an aggregate function.

import "experimental"

experimental.count()

{{% note %}}

Empty tables

experimental.count() returns 0 for empty tables. To keep empty tables in your data, set the following parameters for the following functions:

Function Parameter
filter() onEmpty: "keep"
window() createEmpty: true
aggregateWindow() createEmpty: true
{{% /note %}}

Parameters

tables

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

Examples

import "experimental"

from(bucket: "example-bucket")
    |> range(start: -5m)
    |> experimental.count()