This function returns an integer representing the week number according to ISO 8601. The week number is calculated from the date interpretation of the expression, according to the standard number interpretation.
week(timestamp [, first_week_day [, broken_weeks [, reference_day]]])
Return data type: integer
|timestamp||The date to evaluate as a timestamp or expression resolving to a timestamp, to convert, for example
If you don't specify first_week_day, the value of variable FirstWeekDay will be used as the first day of the week.
If you want to use another day as the first day of the week, set first_week_day to:
The integer returned by the function will now use the first day of the week that you set with first_week_day.
If you don't specify broken_weeks, the value of variable BrokenWeeks will be used to define if weeks are broken or not.
By default Qlik Sense functions use unbroken weeks. This means that:
The alternative is to use broken weeks.
The following values can be used:
If you don't specify reference_day, the value of variable ReferenceDay will be used to define which day in January to set as reference day to define week 1. By default, Qlik Sense functions use 4 as the reference day. This means that week 1 must contain January 4, or put differently, that week 1 must always have at least 4 days in January.
The following values can be used to set a different reference day:
week( '2012-10-12' )
|week( '35648' )||returns 32, because 35648 = 1997-08-06|
|week('2012-10-12', 0, 1)||returns 42|