On this page
Kater SQL Functions Aggregations
KATER__AVG
The average of the field's values.
Family: Aggregations
Syntax
KATER__AVG(field)Arguments
| Argument | Description |
|---|---|
field | The field to aggregate. |
Returns
A number. The field menu writes the @format of the field it reads beside it, or @format number(2) where that field has none.
Usage notes
- Empty values are left out, and do not count as zero.
Example
This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.
SELECT orders.channel AS "Channel", KATER__AVG(orders.discount) AS "Average Discount" /* @format percent(1) */FROM kater_dataset.orders AS ordersGROUP BY orders.channelORDER BY 1| Channel | Average Discount |
|---|---|
| 5.7% | |
| paid | 6.1% |
| store | 6.0% |
| web | 5.4% |
Compiles to
The call compiles to the same SQL on DuckDB and on Snowflake.
AVG(orders.discount)See also
- Measures
- Other functions in Aggregations:
KATER__SUM,KATER__MIN,KATER__MAX,KATER__COUNT,KATER__COUNT_DISTINCT,KATER__COUNT_TRUE,KATER__COUNT_FALSE,KATER__LIST