Week() function returns unexpected value, or different values in different Qlik Sense apps. For example, Week('01/01/2016')
may return 53 (last week of 2015) or 1 (first week of 2016)
The result of Week()
function is affected by 3 environment variables: FirstWeekDay, BrokenWeeks
, which are set in the beginning of a reload script. They take default values according to the localization settings of the server. These variables are explained in details in Qlik Sense help site: FirstWeekDay
If the function returns different values in different Qlik Sense apps, review these variables to make sure the variables are consistent across the apps.
You can also explicitly override the effect of these variables by providing first_week_day, broken_weeks
arguments directly to the Week()
function. For example, the following expressions return fixed values regardless of the 3 environment variables:
- Week('01/01/2016', 0 , 1) returns 1
- Week('01/01/2016', 0 , 0 , 4) returns 53
Please refer to the Week() function help site
for detailed documentation of these arguments.