Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rolling last 12 months and next 12 months needs to display

Hi

My requirement is there i need to display Rolling last 12 month 2017 and next 12 months till June 2019.

It should calculate for Rolling last 12 month as for eg : from yesterday till June 2017  created two variables :

Let vRolling12months = AddMonths(MonthStart(vTodayDate),-12);

LET vTodayDate = DATE(NUM(vtoday)-1);

My syntax for last 12 months i have used and it works absolutely fine:

date(Policydate) >= ('$(vRolling12months)') and date(Policydate) <= ('$(vtoday)');


Now if i want for Next 12 rolling months needs to display i created variable as :


Let vtoday=DATE(today());

let vRollingNext12months = AddMonths(MonthStart(vtoday),+1);


But when i want to add the next 12 rolling months in the above syntax where i have used for last 12 rolling months it not getting displayed as expected.


Could you please help me out in the correcting the syntax.

4 Replies
sunny_talwar

Would you be able to share a sample to check this out? It isn't very clear as to where you are using your expressions

petter
Partner - Champion III
Partner - Champion III

I think the

let vRollingNext12months = AddMonths(MonthStart(vtoday),+1);


needs to be:


let vRollingNext12months = MonthEnd(AddMonths(vtoday),12));

Anonymous
Not applicable
Author

Hi Petter,

Its not working .

I want it should should pick from last 2017 july till 2018 July for last 12rolling months

and for next 12 rolling months it should pick from date of tomorrow till next july 2019.

Can you help me out in this.

petter
Partner - Champion III
Partner - Champion III

A general advice that will help you and others to read your own code is to be consitent in your casing (upper and lower case letters in identifiers). This also has consequences for Qlik's ability to cache and thus speed up calculations.

Have a look at this tiny QlikView app:

2018-07-26 16_18_28-Microsoft Edge.png