# count

Counts the events or non-null grouped values.

```tql
count(xs:list) -> int
```

## Description

The `count` function returns the number of non-null values in `xs`. When used without arguments, it counts the total number of events.

### `xs: list`

The values to count.

## Examples

### Count the number of non-null values

```tql
from {x: 1}, {x: null}, {x: 2}
summarize total=count(x)
```

```tql
{total: 2}
```

## See Also

* [`count_distinct`](https://preview.docs.tenzir.com/375/375/reference/functions/count_distinct.md)
* [Aggregate event streams](https://preview.docs.tenzir.com/375/375/guides/analytics/aggregate-event-streams.md)
* [Plot data with charts](https://preview.docs.tenzir.com/375/375/tutorials/plot-data-with-charts.md)
* [Learn idiomatic TQL](https://preview.docs.tenzir.com/375/375/tutorials/learn-idiomatic-tql.md)