# count_distinct

> Documentation index: http://docs.tenzir.com/llms.txt

Counts all distinct non-null grouped values.

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

## Description

The `count_distinct` function returns the number of unique, non-null values in `xs`.

### `xs: list`

The values to count.

## Examples

### Count distinct values

```tql
from {x: 1}, {x: 2}, {x: 2}, {x: 3}
summarize unique=count_distinct(x)
```

```tql
{unique: 3}
```

## See Also

* [`count`](http://docs.tenzir.com/reference/functions/count.md)
* [`distinct`](http://docs.tenzir.com/reference/functions/distinct.md)
* [Aggregate event streams](http://docs.tenzir.com/guides/analytics/aggregate-event-streams.md)