Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

24 rolling months from last date

How can I get my calendar to display 24 rolling months from the last date in my table of dates? Here's the code for the start end endpoints:

tmp:

LOAD

min(OrderDate) as MinDate,

max(OrderDate) as MaxDate

RESIDENT Orders;

LET Start = floor(YearStart(peek('MinDate')));

LET End = floor(???);

Drop Table tmp;

Grateful for any help!

// John

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

let End = addmonths(peek('MaxDate,0,tmp),24);

View solution in original post

4 Replies
rohit214
Creator III
Creator III

hi john

try this

tmp:

LOAD

min(OrderDate) as MinDate,

max(OrderDate) as MaxDate

RESIDENT Orders;

LET Start = floor(YearStart(peek('MinDate',-1,tmp)));

LET End = floor(YearStart(peek('MaxDate,0,tmp)));

Drop Table tmp;

thanks

rohit

Not applicable
Author

That set the End date of the calendar to january first of the year of the last OrderDate. I need the last date to be 24 months after the last OrderDate.

lironbaram
Partner - Master III
Partner - Master III

let End = addmonths(peek('MaxDate,0,tmp),24);

Not applicable
Author

That works! Thanks a lot!