On this page
Kater SQL Functions Aggregations
KATER__COUNT_TRUE
How many rows have TRUE in the field.
Family: Aggregations
Syntax
KATER__COUNT_TRUE(field)Arguments
| Argument | Description |
|---|---|
field | The field to aggregate. |
Returns
A whole number. The field menu writes @format number(0) beside it.
Usage notes
- FALSE and empty values are not counted.
Example
This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.
SELECT orders.channel AS "Channel", KATER__COUNT_TRUE(orders.is_gift) AS "Gift Orders"FROM kater_dataset.orders AS ordersGROUP BY orders.channelORDER BY 1| Channel | Gift Orders |
|---|---|
| 64 | |
| paid | 62 |
| store | 72 |
| web | 58 |
Compiles to
The call compiles to the same SQL on DuckDB and on Snowflake.
COUNT(CASE WHEN (orders.is_gift) = TRUE THEN 1 END)See also
- Measures
- Other functions in Aggregations:
KATER__SUM,KATER__AVG,KATER__MIN,KATER__MAX,KATER__COUNT,KATER__COUNT_DISTINCT,KATER__COUNT_FALSE,KATER__LIST