---
title: count() function
description: The `count()` function outputs the number of non-null records in a column.
aliases:
  - /v2.0/reference/flux/functions/transformations/aggregates/count
  - /v2.0/reference/flux/functions/built-in/transformations/aggregates/count/
menu:
  v2_0_ref:
    name: count
    parent: built-in-aggregates
weight: 501
related:
  - https://docs.influxdata.com/influxdb/latest/query_language/functions/#count, InfluxQL – COUNT()
---

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_

```js
count(column: "_value")
```

{{% note %}}
#### Count 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()](/v2.0/reference/flux/stdlib/built-in/transformations/filter/)                              | `onEmpty: "keep"`   |
| [window()](/v2.0/reference/flux/stdlib/built-in/transformations/window/)                              | `createEmpty: true` |
| [aggregateWindow()](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/) | `createEmpty: true` |
{{% /note %}}

## Parameters

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

_**Data type:** String_

## Examples
```js
from(bucket: "example-bucket")
  |> range(start: -5m)
  |> count()
```

```js
from(bucket: "example-bucket")
  |> range(start: -5m)
  |> count(column: "_value")
```
