Skip to main content Skip to complementary content

ReferenceDay

The setting defines which day in January to set as reference day to define week 1. In other words, this setting prescribes how many days in week 1 must be dates within January.

Syntax:  

ReferenceDay

ReferenceDay sets how many days are included in the first week of the year. ReferenceDay can be set to any value between 1 and 7. Any value outside of the 1-7 range is interpreted as the midpoint of the week (4), which is equivalent to ReferenceDay being set to 4.

If you do not select a value for the ReferenceDay setting, then the default value will show ReferenceDay=0 which will be interpreted as the midpoint of the week (4), as seen in the ReferenceDay values table below.

The ReferenceDay function is often used in combination with the following functions:

Related functions
Variable Interaction
BrokenWeeks If the Qlik Sense app is operating with unbroken weeks, the ReferenceDay variable setting will be enforced. However, if broken weeks are being used, week 1 will begin on January 1 and terminate in conjunction with the FirstWeekDay variable setting and ignore the ReferenceDay flag.
FirstWeekDay Integer that defines which day to use as the first day of the week.

Qlik Sense allows the following values to be set for ReferenceDay:

ReferenceDay values
Value Reference day
0 (default) January 4
1 January 1
2 January 2
3 January 3
4 January 4
5 January 5
6 January 6
7 January 7

In the following example the ReferenceDay = 3 defines January 3 as the reference day:

SET ReferenceDay=3; //(set January 3 as the reference day)

For more information about using inline loads, see Using inline loads to load data.

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples. For more information, see Modifying regional settings for apps and scripts.

Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps and scripts in Qlik Cloud Analytics.

Examples:  

If you want ISO settings for weeks and week numbers, make sure to have the following in the script:

Set FirstWeekDay=0; Set BrokenWeeks=0; Set ReferenceDay=4; // Jan 4th is always in week 1

If you want US settings, make sure to have the following in the script:

Set FirstWeekDay=6; Set BrokenWeeks=1; Set ReferenceDay=1; // Jan 1st is always in week 1

Example 1 - Load script using the default value; ReferenceDay=0

Example - ReferenceDay variable set to 5

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!