Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

master calender here i get script line error .what is this error

my code is

pls help

tab1:

LOAD  * Inline [

id,productname,price,geog,date

1,lenova,25000,uk,1-1-2010

2,dell,18000,us,1-2-2011

3,acer,25000,ind,12-11-2012

4,asus,28000,uk,13-10-2013

5,hp,21000,jer,15-09-2014

];

sort:

LOAD * Resident tab1 Order by date;

LET vmax= Num(Peek('date',-1,'sort'));

LET vmin = Num(Peek('date',0,'sort'));

temp:

Load

date($(vmin) + rowno() -1) As tempdate

Autogenerate

$(vmax)-$(vmin)+1;

mastercalender:

LOAD tempdate,

     

      tempdate as datefield,

      Year(tempdate) as year,

      Month(tempdate) as month,

      'Q'&Ceil(Month(tempdate)/3) as quarter,

      Week(tempdate) as week

     

      Resident temp ;

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Most likely your date values  like '1-1-2010' are not recognized as dates. Try using the date# function in the first load to create real date values:


tab1:

LOAD  id,productname,price,geog,date(date#(date,'D-M-YYYY'),''D-M-YYYY) as date Inline [

id,productname,price,geog,date

1,lenova,25000,uk,1-1-2010

2,dell,18000,us,1-2-2011

3,acer,25000,ind,12-11-2012

4,asus,28000,uk,13-10-2013

5,hp,21000,jer,15-09-2014

];


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Following on from Gysbert, try something like this :

tab1:

LOAD 

  id,

  productname,

  price,

  geog,

  date(date#(date,'D-M-YYY')) as date

;

load * Inline [

id,productname,price,geog,date

1,lenova,25000,uk,1-1-2010

2,dell,18000,us,1-2-2011

3,acer,25000,ind,12-11-2012

4,asus,28000,uk,13-10-2013

5,hp,21000,jer,15-09-2014

];

temp1:

LOAD date as tempdate Resident tab1 Order by date;

LET vmax= num(Peek('tempdate',-1));

LET vmin = num(Peek('tempdate',0));

drop table temp1 ;

temp2:

Load

rowno() ,

date($(vmin) + rowno() -1) As tempdate

Autogenerate

$(vmax)-$(vmin)+1;

mastercalender:

LOAD tempdate,

      tempdate as datefield,

      Year(tempdate) as year,

      Month(tempdate) as month,

      'Q'&Ceil(Month(tempdate)/3) as quarter,

      Week(tempdate) as week

      Resident temp2 ;

     

drop table temp2;