Skip to content

count_if

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}

count

Last updated: