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

Master calender error?

     Hi,

kindly find below Attachment....

Master Calender, variablesare  not working

Regards,

K

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Let varMaxDate = Num(Peek('OrderDate',-1,'t1));

The last quote character is a not a single quote, but another quote character. Replace it by a real single quote.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Let varMaxDate = Num(Peek('OrderDate',-1,'t1));

The last quote character is a not a single quote, but another quote character. Replace it by a real single quote.


talk is cheap, supply exceeds demand
rustyfishbones
Master II
Master II

You have this in the Script

2014-10-31_1239.png

you should have below, so you need to change the last quote to single quote

2014-10-31_1239_001.png

its_anandrjs

Try this load script and your Min and Max variable calculate wrong may be due to the wrong order in the table in peek function by -1 you get min value which opposite to the order or my be change in the variable i change it right now check the load script.

t1:

LOAD OrderID,

     ProductID,

     Product,

     CustomerID,

     EmployeeID,

     OrderDate,

     Margin,

     Sales,

     Cost,

     Quantity

FROM

Sales.xls

(biff, embedded labels, table is Orders$);

LET varMaxDate = Num(Peek('OrderDate', 0, 't1'));

LET varMinDate = NUM(Peek('OrderDate', -1,  't1'));

TempCalendar:

LOAD

$(varMinDate) + RowNo() - 1 AS DateNumber,

Date($(varMinDate) + RowNo() - 1) AS TempDate

AUTOGENERATE 1

WHILE $(varMinDate)+IterNo()-1<= $(varMaxDate);

MasterCalendar:

Load

TempDate As OrderDate,

Week(TempDate) As Week,

Year(TempDate) As Year,

Month(TempDate) As Month

resident TempCalendar;

Note:- Copy and paste this load script and variable script also.

Regards

Anand

MK_QSL
MVP
MVP

t1:

LOAD OrderID,

     ProductID,

     Product,

     CustomerID,

     EmployeeID,

     OrderDate,

     Margin,

     Sales,

     Cost,

     Quantity

    

FROM

Sales.xls

(biff, embedded labels, table is Orders$);

MinMaxDate:

Load Min(OrderDate) as MinDate, Max(OrderDate) as MaxDate Resident t1;

Let varMinDate =Num(Peek('MinDate',0,'MinMaxDate'));

Let varMaxDate = Num(Peek('MaxDate',-1,'MinMaxDate'));

Drop Table MinMaxDate;

TempCalendar:

Load

  $(varMinDate) + IterNo() - 1 as TempDate

Autogenerate 1

While $(varMinDate) + IterNo() - 1 <= $(varMaxDate);

MasterCalendar:

Load

  TempDate As OrderDate,

  Week(TempDate) As Week,

  Year(TempDate) As Year,

  Month(TempDate) As Month

Resident TempCalendar;

Drop Table TempCalendar;