On this page
Kater SQL Functions Aggregations
KATER__COUNT
How many rows have a value in the field.
Family: Aggregations
Syntax
KATER__COUNT(field)Arguments
| Argument | Description |
|---|---|
field | The field to aggregate. |
Returns
A whole number. The field menu writes @format number(0) beside it.
Usage notes
- It compiles to
COUNT(field), so a row whose field is empty is not counted. - To count every row, count a field that is never empty, such as an ID.
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(orders.order_id) AS "Orders", KATER__COUNT(orders.notes) AS "Orders with Notes"FROM kater_dataset.orders AS ordersGROUP BY orders.channelORDER BY 1| Channel | Orders | Orders with Notes |
|---|---|---|
| 778 | 444 | |
| paid | 762 | 442 |
| store | 754 | 455 |
| web | 706 | 415 |
Compiles to
The call compiles to the same SQL on DuckDB and on Snowflake.
COUNT(orders.order_id)See also
- Measures
- Other functions in Aggregations:
KATER__SUM,KATER__AVG,KATER__MIN,KATER__MAX,KATER__COUNT_DISTINCT,KATER__COUNT_TRUE,KATER__COUNT_FALSE,KATER__LIST