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