month

month, data type

The month is a primitive data type, representing months as the combination of a year and a month number within that year, such as 2001-01 (the earliest month representable in Envision) or 2020-10.

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

Date arithmetic is supported by the month type: monthA + 1 is the month right after monthA, and monthA - monthB is the number of months between monthA and monthB.

month(y: number, m: number) 🡒 month, pure function

Returns the month number m in year y ; will raise an error if the combination is incorrect.

Example:

show scalar "" with 
  month(2020, 10) // 2020-10

month(d: date) 🡒 month, pure function

Returns the month associated to the specified date.

Example:

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

Month, built-in table

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

table Month[month] = by month(date)

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

week, primary dimension

The primary dimension of table Month is named month, and it is of type month.

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