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: 
vignesh_s
Creator
Creator

hi

can any1 explain the below expresion

let varMinDate=Num(Peek('OrderDate',0,'Order'));

let varMaxDate=Num(peek('OrderDate',-1,'Order'));

let Vartoday=Num(today());

DateField:

LOAD

$(VarMinDate)+rowno()-1 as Num,

Date($(varMinDate)+RowNo()-1) as tempdate

AutoGenerate

$(varMaxDate)-$(varMinDate)+1;

1 Solution

Accepted Solutions
stabben23
Partner - Master
Partner - Master

Hi, some input here, lets pretend that Your OrderDate is from 2017/01/01 to 2017/12/31

$(VarMinDate)+rowno()-1 as Num, //this will use Your variable VarMinDate as a numeric value and plus the number of rowno(), in this case 0

ex 42736

Date($(varMinDate)+RowNo()-1) as tempdate //This do the same as above but create a date format ex 2017/01/01

AutoGenerate

$(varMaxDate)-$(varMinDate)+1  //this will autogenerate rows, in Your case 43100-42736=364+1, which is Your OrderDates

43100 is 2017/12/31

So this will create a calendar for you With Your OrderDate, important as Thomasz says: Order table need to be sorted asc as you use peek

View solution in original post

5 Replies
tomasz_tru
Specialist
Specialist

There must be Order table with OrderDate field, Zero in peek means it gets first OrderDate value, -1 means it takes last one. Then it generated dates between, but I would check if OrdreDate is sorted.

vignesh_s
Creator
Creator
Author

thanks

can u explain this part

$(VarMinDate)+rowno()-1 as Num,

Date($(varMinDate)+RowNo()-1) as tempdate

AutoGenerate

$(varMaxDate)-$(varMinDate)+1 

Anonymous
Not applicable

without data it will be difficult to the members to help you out, please take some time to provide sample data if possible.

stabben23
Partner - Master
Partner - Master

Hi, some input here, lets pretend that Your OrderDate is from 2017/01/01 to 2017/12/31

$(VarMinDate)+rowno()-1 as Num, //this will use Your variable VarMinDate as a numeric value and plus the number of rowno(), in this case 0

ex 42736

Date($(varMinDate)+RowNo()-1) as tempdate //This do the same as above but create a date format ex 2017/01/01

AutoGenerate

$(varMaxDate)-$(varMinDate)+1  //this will autogenerate rows, in Your case 43100-42736=364+1, which is Your OrderDates

43100 is 2017/12/31

So this will create a calendar for you With Your OrderDate, important as Thomasz says: Order table need to be sorted asc as you use peek

vignesh_s
Creator
Creator
Author

Thank you so much,it helped to me to understand in right manner