Documentation

count() function

Flux 0.7.0+

The count() function outputs the number of records in a column. It counts both null and non-null records. count() is an aggregate function.

Output data type: Integer

count(column: "_value")

Empty tables

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

FunctionParameter
filter()onEmpty: "keep"
window()createEmpty: true
aggregateWindow()createEmpty: true

Parameters

column

The column on which to operate. Defaults to "_value".

tables

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

Examples

The following example uses data provided by the sampledata package to show how count() transforms data.

Count the number of rows in each input table

import "sampledata"

sampledata.string()
  |> count()

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.