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
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 |
Parameters
column
The column on which to operate. Defaults to "_value"
.
*Data type: String*
Examples
from(bucket: "example-bucket")
|> range(start: -5m)
|> count()
from(bucket: "example-bucket")
|> range(start: -5m)
|> count(column: "_value")