count() function

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

*Function type: Aggregate
**
Output data type:* Integer

  1. 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".

*Data type: String*

Examples

  1. from(bucket: "example-bucket")
  2. |> range(start: -5m)
  3. |> count()
  1. from(bucket: "example-bucket")
  2. |> range(start: -5m)
  3. |> count(column: "_value")

Related articles