Skip to main content Skip to complementary content

inmonthtodate - script and chart function

Returns True if date lies inside the part of month containing basedate up until and including the last millisecond of basedate.


InMonthToDate (timestamp, base_date, period_no)

Return data type: Boolean

Diagram of inmonthtodate function.

Diagram showing how inmonthtodate function can be used to identify if a timstamp falls within or outside of a set month.

The inmonthtodate() function identifies a selected month as a segment. The start boundary is the beginning of the month. The end boundary can be set as a later date in the month. It then determines whether a set of dates fall into this segment or not, returning a TRUE or FALSE Boolean value.

Argument Description
timestamp The date that you want to compare with base_date.
base_date Date that is used to evaluate the month.

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.

The inmonthtodate() function returns a Boolean result. Typically, this type of function is used as a condition in an if expression. The inmonthtodate() function returns an aggregation or calculation that depends on whether a date occurred in the month up to and including the date in question.

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

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
inmonthtodate ('01/25/2013', '25/01/2013', 0) Returns True
inmonthtodate ('01/25/2013', '24/01/2013', 0) Returns False
inmonthtodate ('01/25/2013', '28/02/2013', -1) Returns True

Example 1 – No additional arguments

Example 2 – period_no

Example 3 – Chart example

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!