isoyear(X)

Returns the ISO-8601 week-numbering year for a given date or timestamp. (Available as of version 16.04)

Syntax

isoyear(X)

Input

Argument Type Description
X integer or decimal A scalar value or the name of a column containing date-related values
Valid values can be of the form:
  • date
  • month
  • quarter
  • date+time

For more information, see Dates and time .

Return Value

Returns the integer value (e.g., 1=Monday, 2=Tuesday ... 7=Sunday) corresponding to the day of the week based on the input.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

Applying this function to a date column in a table will calculate the year number for each row. Note that since the date in the below image is the last day of the year, it is in a week that includes the first few days of the new year, so the year-number is showing 2013 even though the date is from 2012:

<base table="retaildemo.retail.sales_detail"/>
<willbe name="isoyear" value="isoyear(date)"/>
<colord cols="date,isoyear"/>

Example

Applying this function to a scalar value which represents a date will simply return the year number corresponding to that date.

<base table="retaildemo.retail.sales_detail"/>
<willbe name="isoyear" value="isoyear(20120531)"/>
<colord cols="isoyear"/>