week
week, data type
The week type represents ISO weeks such as 2020-W45. There are no week
literals; use the week() function.
week, function
def const pure week(y: number, w: number): week
def const pure week(d: date): week
Returns the ISO week for a given year/week pair or for a date.
Example (year and week)
show scalar "Week" with week(2020, 45)
This outputs the following scalar:
| Label | Value |
|---|---|
| Week | 2020-W45 |
Example (from date)
show scalar "Week" with week(date(2019, 12, 30))
This outputs the following scalar:
| Label | Value |
|---|---|
| Week | 2020-W01 |
Week, calendar table
Week is a special calendar table created by span or by read with
expect [date]. Its primary dimension is week.
Example
keep span date = [date(2024, 1, 1) .. date(2024, 1, 14)]
Week.Days = count(Day.*)
show table "Week size" with
week
Week.Days
This outputs the following table:
| week | Days |
|---|---|
| 2024-W01 | 7 |
| 2024-W02 | 7 |