COUNT_VALUES_IF
Returns the number of true
values in a given array.
This can be used with conditional operators to count the number of array elements that fulfil a condition. For example, COUNT_VALUES_IF(my_values[] > 3)
will return the number of elements that are greater than 3.
Syntax
Arguments
Name | Type | Description | Default Value |
---|---|---|---|
input | Boolean | The input array |
Returns
the number of times true
appeared in the input array. a primitive value is considered to be an array with one element.
Examples
input | Output |
---|---|
null::Boolean | 0 |
array[true, false, true] | 2 |
Transformation job example
SQL
Query result
input | Output |
---|---|
null::Boolean | 0 |
Last updated