count() function

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:

Function Parameter
filter() onEmpty: "keep"
window() createEmpty: true
aggregateWindow() createEmpty: true



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


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


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"

    |> count()

View input and output

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.