week, data type

The week is a primitive data type, representing ISO weeks as the combination of a year and a week number within that year, such as 2001-W01 (the earliest week representable in Envision) or 2020-W45.

read "Promo.ion" as Promotions with 
  StartWeek : week
  EndWeek : week

Date arithmetic is supported by the week type: weekA + 1 is the week right after weekA, and weekA - weekB is the number of weeks between weekA and weekB.

week(y: number, w: number) 🡒 week, const pure function

Returns a week with ISO week number w in year y ; will raise an error if the combination is incorrect.

show scalar "" with 
  week(2020, 45) // 2020-W45

week(d: date) 🡒 week, const pure function

Returns the week associated to the specified date.

show summary "" a1a3 with
  week(date(2019, 12, 28))
  week(date(2019, 12, 30))
  week(date(2020, 1, 1))

Week, built-in table

The table Week is automatically defined if the date dimension is used in a script. It contains, at any point in the script, the set of weeks that have at least one of their days appear in table Day. In effect, this is equivalent to the definition:

table Week[week] = by week(date)

However, unlike a normal by table, the Week table is automatically updated every time the Day table is filtered or expanded.

week, primary dimension

The primary dimension of table Week is named week, and it is of type week.

If a table has dimension date (either as primary or non-primary dimension), it automatically receives week as a non-primary dimension as well.

User Contributed Notes
0 notes + add a note