Skip to main content
On this page

Kater SQL Functions Date grains

KATER__WEEK

The first day of the week the date is in.

Family: Date grains

Syntax

KATER__WEEK(field)

Arguments

ArgumentDescription
fieldThe date or timestamp.

Returns

A date.

Usage notes

  • A week starts on Monday, as an ISO week does. On Snowflake, the account’s WEEK_START setting can change the first day.

Example

This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.

SELECT
orders.order_id AS "Order ID",
orders.order_date AS "Order Date",
DIMENSION('order_date_week', KATER__WEEK(orders.order_date)) AS "Week"
FROM kater_dataset.orders AS orders
ORDER BY
1
LIMIT 3
Order IDOrder DateWeek
O000002025-05-262025-05-26
O000012025-11-282025-11-24
O000022025-07-252025-07-21

Compiles to

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

CAST(DATE_TRUNC('WEEK', orders.order_date) AS DATE)

See also