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.
Syntax:
InMonthToDate (timestamp, base_date, period_no)
Return data type: Boolean
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. |
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. |
When to use it
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.
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 |