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

Error in Master Calendar

Hi, i am new in Qlik Sense and i'm trying to fix a data load script that someone else has write.

I have the following error:

Unexpected token: ',', expected one of: 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', 'and', ...
El error se ha producido aquí:
TempCalendar:
LOAD
42737,227013889 + Iterno()-1 As Num,
Date(42737,227013889 + IterNo() - 1) as TempDate
AutoGenerate 1 While 42737>>>>>>,<<<<<<227013889 + IterNo() -1 <= 43736,508506944

In the following code:

QuartersMap:
MAPPING LOAD
rowno() as Mes,
'Q' & Ceil (rowno()/3) as Cuatrimestre
AUTOGENERATE (12);

//Calendario stock

Temp:
Load
min(Fecha) as minDate,
max(Fecha) as maxDate
Resident fact_ventas;

Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;

TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);

fact_comercial_calendario:
Load
date(`TempDate`, 'DD/MM/YYYY') as Fecha,
week(TempDate) As Semana,
Year(TempDate) As Año,
Month(TempDate) As Mes,
Num(Month(TempDate)) As Mes_num,
Month(date(Date(TempDate)))&'-'&Year(date(Date(TempDate))) as Periodo,
Day(TempDate) As Dia

Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;

 

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

The problem is that your value to create the calendar isn't a date else a timestamp - and further that this timestamp has wrong number-formatting because it has a comma as decimal delimiter (probably the value comes from a variable and needs to be formatted there with something like: num(value, '#####', '.', ' ') - but better would be just: floor(value) because a timestamp is wrong within a calendar).

- Marcus

View solution in original post

2 Replies
marcus_sommer

The problem is that your value to create the calendar isn't a date else a timestamp - and further that this timestamp has wrong number-formatting because it has a comma as decimal delimiter (probably the value comes from a variable and needs to be formatted there with something like: num(value, '#####', '.', ' ') - but better would be just: floor(value) because a timestamp is wrong within a calendar).

- Marcus

francisco_garcia
Contributor III
Contributor III
Author

Hi Marcus, yes, i've realized that a few seconds before you answer me.

I ve' changed the data type to DATE and it worked.

Than you very much.