Skip to main content
Version: v4.24

count_distinct

Counts all distinct non-null grouped values.

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

from [
  {x: 1},
  {x: 2},
  {x: 2},
  {x: 3},
]
summarize unique=count_distinct(x)
{unique: 3}

See Also

count, distinct