Skip to main content Skip to complementary content

inlunarweektodate - script and chart function

This function finds if timestamp lies inside the part of the lunar week up to and including the last millisecond of base_date. Lunar weeks in Qlik Sense are defined by counting January 1 as the first day of the week and, apart from the final week of the year, will contain exactly seven days.


InLunarWeekToDate (timestamp, base_date, period_no [, first_week_day])

Return data type: Boolean

Information note

In Qlik Sense, the Boolean true value is represented by -1, and the false value is represented by 0.

Example diagram of inlunarweektodate() function

Example diagram of inlunarweektodate function, showing the dates for which the function will return a TRUE value, given the input information.

IThe inlunarweektodate() function acts as the end point of the lunar week. In contrast, the inlunarweek() function, determines which lunar week the base_date falls into. For example, if the base_date were January 5, any timestamp between January 1 and January 5 would return a Boolean result of TRUE, while dates on January 6 and 7, and later, would return a Boolean result of FALSE.

Argument Description
timestamp The date that you want to compare with base_date.
base_date Date that is used to evaluate the lunar week.
period_no The lunar week can be offset by period_no. period_no is an integer, where the value 0 indicates the lunar week which contains base_date. Negative values in period_no indicate preceding lunar weeks and positive values indicate succeeding lunar weeks.
first_week_day An offset that may be greater than or less than zero. This changes the beginning of the year by the specified number of days and/or fractions of a day.

When to use it

The inlunarweektodate() function returns a Boolean result. Typically, this type of function will be used as a condition in an IF expression. The inlunarweektodate() function would be used when the user would like the calculation to return an aggregation or calculation, dependent on whether the evaluated date occurred during a particular segment of the week in question.

For example, the inlunarweektodate() function can be used to identify all equipment manufactured in a particular week up to and including a particular date.

Function examples
Example Result
inlunarweektodate('01/12/2013', '01/13/2013', 0) Returns TRUE, since the value of the timestamp, 01/12/2013, falls in the part of the week 01/08/2013 to 01/13/2013.
inlunarweektodate('01/12/2013', '01/11/2013', 0) Returns FALSE, since the value of the timestamp is later than the value of base_date, even though the two dates are in the same lunar week before 01/12/2012.
inlunarweektodate('01/12/2006', '01/05/2006', 1) Returns TRUE. Specifying a value of 1 for period_no shifts the base_date forward one week, so the value of timestamp falls in the part of the lunar week.

The inlunarweektodate() function is often used in combination with the following functions:

Related functions
Function Interaction
lunarweekname - script and chart function This function is used to determine the lunar week number of the year in which an input date occurs.

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.

Default regional settings in apps are based on the regional system settings of the computer or server where Qlik Sense is installed. If the Qlik Sense server you are accessing is set to Sweden, the Data load editor will use Swedish regional settings for dates, time, and currency. These regional format settings are not related to the language displayed in the Qlik Sense user interface. Qlik Sense will be displayed in the same language as the browser you are using.

Example 1 - No additional arguments

Example 2 - period_no

Example 3 - first_week_day

Example 4 - Chart object example

Example 5 - Scenario

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!