Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Current and Previous YEAR MTD, QTD and YTD

Dear all,

I'm trying to set on my Master Calendar some key flags...However, if the CYTDFlag and LYTDFlag works correctl, the month and quarter indicators are not working correctly.

In fact ONLY the current month (July 2013) is selected based on the date set by the $(varTD) which is 31/07/2013.

What I want is to have the Full Q3 selected. for the month, the issue is on the LMTDFlag.

START ---------------------

InMonth (TempDate, $(varTD),0)*-1 as CMTDFlag, // Current MONTH (select from 1st date of varTD month to last date eg. 01/07/2013 to 31/07/2013)

               InMonth (TempDate, $(varTD),-1)*-1 as LMTDFlag, // Same MONTH LATS YEAR (eg. 01/07/2012 to 31/07/2012)

               InQuarter (TempDate, $(varTD),0)*-1 as CQTDFlag, // Current QUARTER (select from 1st date of varTD quarter to last date eg. 01/07/2013 to 31/09/2013)

               InQuarter (TempDate, $(varTD),-1)*-1 as LQTDFlag, // Same Quarter from Last Year (eg. 01/07/2012 to 31/09/2012)

               InYearToDate (TempDate, $(varTD),0)*-1 as CYTDFlag, // Year to Date (select form 1st date of varTD  to last date eg. 01/01/2013 to 31/09/2013)

               InYearToDate (TempDate, $(varTD),-1)*-1 as LYTDFlag// Same Year to Date BTU last year (eg. 01/01/2012 to 31/09/2012)

1 Solution

Accepted Solutions
whiteline
Honored Contributor II

Re: Current and Previous YEAR MTD, QTD and YTD

Hi.

If I understand right the LMTDFlag should be set for all the TempDate that has same month as current in $(varTD).

Accordin to reference manual the third parameter of InMonth function represents the shift in months. So I guess it should be -12 instead.

For InQuarter it should be -4 respectively.

2 Replies
whiteline
Honored Contributor II

Re: Current and Previous YEAR MTD, QTD and YTD

Hi.

If I understand right the LMTDFlag should be set for all the TempDate that has same month as current in $(varTD).

Accordin to reference manual the third parameter of InMonth function represents the shift in months. So I guess it should be -12 instead.

For InQuarter it should be -4 respectively.

Not applicable

Re: Current and Previous YEAR MTD, QTD and YTD

Thanks! Works perfectly.

Community Browser