Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

MASTER CALENDAR - FIELD(YEARMONTH)

Hello,

 

I have a field date whit this format

201801, 201802, ....

when i create the Master Calendar just recognize 3 dates:

 
 

 

 

 

 

 

 

 

 

 

 

This is the scrip i use in the MasterCalendar

TABLA_CALENDARIO:
NoConcatenate
Load
     Periodo
Resident CKM3N;

//--------------------------------------//
// SETEO DE VARIABLES PARA EL CALENDARIO//
//--------------------------------------//

LET varMinDate = Num(Peek('Periodo', 0, 'TABLA_CALENDARIO'));
LET varMaxDate = Num(Peek('Periodo', -1, 'TABLA_CALENDARIO'));
DROP TABLE TABLA_CALENDARIO;

//*************** Temporary Calendar ***************

TempCalendar:
LOAD
   $(varMinDate) + rowno()-1 AS Num,
    DATE($(varMinDate) + rowno()-1) AS TempDate
AUTOGENERATE
$(varMaxDate)- $(varMinDate)+ 1;

//*************** Master Calendar ***************

MasterCalendar:
LOAD
  AutoNumber(TempDate)    AS [key_Año_Mes],
  TempDate,
  month(TempDate)    AS Month,
  year(TempDate)    AS Year,
  Month(TempDate)    AS MesCalen,
  date(monthstart(TempDate), 'MMM-YYYY') AS MesAño
RESIDENT TempCalendar
ORDER BY TempDate Asc;
DROP TABLE TempCalendar;

 

Thx for all the help

 

 
1 Solution

Accepted Solutions

Try this

TABLA_CALENDARIO:
NoConcatenate
Load Min(Date#(Periodo, 'YYYYMM')) as Min,
     Max(Date#(Periodo, 'YYYYMM')) as Max,
Resident CKM3N;

//--------------------------------------//
// SETEO DE VARIABLES PARA EL CALENDARIO//
//--------------------------------------//

LET varMinDate = Num(Peek('Min'));
LET varMaxDate = Num(Peek('Max'));
DROP TABLE TABLA_CALENDARIO;

View solution in original post

2 Replies

Try this

TABLA_CALENDARIO:
NoConcatenate
Load Min(Date#(Periodo, 'YYYYMM')) as Min,
     Max(Date#(Periodo, 'YYYYMM')) as Max,
Resident CKM3N;

//--------------------------------------//
// SETEO DE VARIABLES PARA EL CALENDARIO//
//--------------------------------------//

LET varMinDate = Num(Peek('Min'));
LET varMaxDate = Num(Peek('Max'));
DROP TABLE TABLA_CALENDARIO;

View solution in original post

Contributor II
Contributor II

It work's, Thx a lot