Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
kindly find below Attachment....
Master Calender, variablesare not working
Regards,
K
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.
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.
You have this in the Script
you should have below, so you need to change the last quote to single quote
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
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;