Counts the events or non-null grouped values matching a given predicate.
count_if(xs:list, predicate:any -> bool) -> int
Description
Section titled “Description”The count_if
function returns the number of non-null values in xs
that
satisfy the given predicate
.
xs: list
Section titled “xs: list”The values to count.
predicate: any -> bool
Section titled “predicate: any -> bool”The predicate to apply to each value to check whether it should be counted.
Examples
Section titled “Examples”Count the number of values greater than 1
Section titled “Count the number of values greater than 1”from {x: 1}, {x: null}, {x: 2}summarize total=x.count_if(x => x > 1)
{total: 1}