Skip to main 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[, first_month_of_year])

Return data type: Boolean

Arguments:  

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

first_month_of_year

The first_month_of_year parameter is disabled and reserved for future use.

Example 1:  

inmonth ('25/01/2013', '01/01/2013', 0 )

Returns True

Example 2:  

inmonth('25/01/2013', '01/04/2013', 0)

Returns False

Example 3:  

inmonth ('25/01/2013', '01/01/2013', -1)

Returns False

Example 4:  

inmonth ('25/12/2012', '01/01/2013', -1)

Returns True

Example 5:  

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

This example checks if an invoice date falls at any time in the fourth month after the month in base_date, by specifying period_no as 4.

TempTable:

LOAD RecNo() as InvID, * Inline [

InvDate

28/03/2012

10/12/2012

5/2/2013

31/3/2013

19/5/2013

15/9/2013

11/12/2013

2/3/2014

14/5/2014

13/6/2014

7/7/2014

4/8/2014

];

 

InvoiceData:

LOAD *,

InMonth(InvDate, '31/01/2013', 4) AS InMthPlus4

Resident TempTable;

Drop table TempTable;

The resulting table contains the original dates and a column with the return value of the inmonth() function.

Example 5 results
InvDate InMthPlus4
28/03/2012 0 (False)
10/12/2012 0 (False)
5/2/2013 0 (False)
31/3/2013 0 (False)
19/5/2013 -1 (True)
15/9/2013 0 (False)
11/12/2013 0 (False)
2/3/2014 0 (False)
14/5/2014 0 (False)
13/6/2014 0 (False)
7/7/2014 0 (False)
4/8/2014 0 (False)

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!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com