Skip to content
Legacy docs for Tenzir v5.x. For the latest Tenzir v6 series, visit docs.tenzir.com. Migrating from v5? Read the Tenzir v6 migration guide.

Counts the events or non-null grouped values matching a given predicate.

count_if(xs:list, predicate:any -> bool) -> int

The count_if function returns the number of non-null values in xs that satisfy the given predicate.

The values to count.

The predicate to apply to each value to check whether it should be counted.

from {x: 1}, {x: null}, {x: 2}
summarize total=x.count_if(x => x > 1)
{total: 1}

Last updated: