Skip to main content
On this page

Kater SQL Functions Aggregations

KATER__AVG

The average of the field's values.

Family: Aggregations

Syntax

KATER__AVG(field)

Arguments

ArgumentDescription
fieldThe 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 orders
GROUP BY
orders.channel
ORDER BY
1
ChannelAverage Discount
email5.7%
paid6.1%
store6.0%
web5.4%

Compiles to

The call compiles to the same SQL on DuckDB and on Snowflake.

AVG(orders.discount)

See also