Skip to main content Skip to complementary content

inmonth - script and chart function

This function returns True if timestamp lies inside the month containing base_date.

Syntax:  

InMonth (timestamp, base_date, period_no)

Diagram of indaytotime function.

Diagram showing the conditions of the inmonth function.

In other words, the inmonth() function determines if a set of dates fall into this month and returns a Boolean value based on a base_date that identifies the month.

The inmonth() function returns a Boolean result. Typically, this type of function will be used as a condition in an if expression. This returns an aggregation or calculation depending on whether a date occurred in the month, including the date in question.

For example, the inmonth() function can be used to identify all equipment manufactured in a specific month.

Return data type: Boolean

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

Arguments
Argument Description
timestamp The date that you want to compare with base_date.
base_date Date that is used to evaluate the month. It is important to note that the base_date can be any day within a month.
period_no The month can be offset by period_no. period_no is an integer, where the value 0 indicates the month which contains base_date. Negative values in period_no indicate preceding months and positive values indicate succeeding months.

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.

Function examples
Example Result
inmonth ('25/01/2013', '01/01/2013', 0) Returns True
inmonth('25/01/2013', '23/04/2013', 0) Returns False
inmonth ('25/01/2013', '01/01/2013', -1) Returns False
inmonth ('25/12/2012', '17/01/2013', -1) Returns True

Example 1 – No additional arguments

Example 2 – period_no

Example 3 – Chart object

Example 4 – 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!