Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello everybody. below the message i get while loading (generic field names for privacy):
Error in expression: AddYears takes 2 parameters
Concatenate
LOAD
AddYears (DATE, 1) as DATE,
NET_SALES_1,
GROSS_SALES_1,
PIECES_1
FROM
["EXCEL ORIGIN"]
Where
DATE <= AddYears(, -1)
in the latest AddYears, just above, on the script I put $(=max(DATE))
Hi,
please attach the snippet where you are assigning the value to the variable.
S.
Hi, you can't use $(=max(DATE)) in script like in an expression.
One way to get that is:
- first load your dates using order by to get the max date in the first row:
Dates_tmp:
LOAD DATE as DATE_tmp
FROM.... order by DATE desc;
- assign that row value to a variable:
LET vMaxDate = Peek('DATE_tmp', 0, 'Dates_tmp');
-then you can use that variable in the where clause:
DATE <= AddYears('$(vMaxDate)' , -1)
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='€ #.##0,00;-€ #.##0,00';
SET TimeFormat='h.mm.ss';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY h.mm.ss[.fff]';
SET MonthNames='gen;feb;mar;apr;mag;giu;lug;ago;set;ott;nov;dic';
SET DayNames='lun;mar;mer;gio;ven;sab;dom';
TransactionTable:
LOAD
ID,
SHOP,
DATE,
NET_SALES,
GROSS_SALES,
PIECES
FROM
[EXCEL];
Concatenate
LOAD
AddYears (DATE, 1) as DATE,
NET_SALES_1,
GROSS_SALES_1,
PIECES_1
FROM
[EXCEL]
Where
DATE <= AddYears($(=max(DATE)), -1);
DataTable:
load distinct
DATE,
month(DATE) as MONTH,
year(DATE) as YEAR
resident TransactionTable;
ABOVE MY COMPLETE LOAD SCRIPT, I JUST WANTED TO RECREATE THIS CENARY