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. 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.

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!