Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Master Calendar with 2 Date Fields

Hello!

I have the following Master Calendar:

LK_DATE_TMP:

LOAD *,

  DATE( MAKEDATE(ID_TIE_AÑO,ID_TIE_MES,ID_TIE_DIA),'YYYYMMDD') AS KEY_PERIODO,

  DATE( MAKEDATE(ID_TIE_AÑO,ID_TIE_MES),'YYYYMM') AS ID_TIE_AÑOMES,

  DATE( MAKEDATE(ID_TIE_AÑO,ID_TIE_MES),'MMM-YY') AS ID_TIE_AÑOMESDESC,

  DATE( MAKEDATE(ID_TIE_AÑO,ID_TIE_MES,ID_TIE_DIA),'YYYYMMDD') AS ID_TIE_AÑOMESDIA,

  'Q'&ceil(ID_TIE_MES/3) AS ID_TIE_TRIMESTRE;

LOAD ID_TIE_FECHA,

  YEAR(ID_TIE_FECHA) AS ID_TIE_AÑO,

  MONTH(ID_TIE_FECHA) AS ID_TIE_MES,

  NUM(MONTH(ID_TIE_FECHA)) AS ID_TIE_MES#,

  NUM(DAY(ID_TIE_FECHA)) AS ID_TIE_DIA,

  WEEKDAY(ID_TIE_FECHA) AS ID_TIE_DIA_SEMANA,

  NUM(ID_TIE_FECHA) AS ID_TIE_FECHA#;

LOAD

  DATE(MAKEDATE(2007,1,1)+(ITERNO()-1),'YYYYMMDD') AS ID_TIE_FECHA

AUTOGENERATE 1

WHILE DATE(MAKEDATE(2007,1,1)+(ITERNO()-1)) <= DATE(MAKEDATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())));

MASTER_CALENDAR:

NOCONCATENATE

LOAD DISTINCT

  *

RESIDENT LK_FECHA_TMP

WHERE EXISTS(FECHA_GESTION,ID_TIE_FECHA);

DROP FIELD FECHA_GESTION;

DROP TABLE LK_FECHA_TMP;

Then I have my transactional table with all the information related to the Tasks.

The Master Calendar is asociated to the Tasks table by the "Complete Date":

TASKS:

     Field1,

     Field2,

     Field3,

  DATE (FLOOR (COMPLETE_DTTM), 'YYYYMMDD')as KEY_PERIODO,
  DATE (FLOOR (COMPLETE_DTTM), 'YYYYMMDD')as FECHA_GESTION

Everything works okay so far, but the thing is that now I have another table, Pays, which has a field named "Pay Date" and Amounts, and I'd like to use the same Master Calendar to see my information by both, the "Complete Date" and also by the "Pay Date" if I select a particular date, to visualize the associated data. How could I do that? Should I add the following?

PAYS:

     Field1_Pay,

     Field2_Pay,

     Field3_Pay,

     Amounts,

  DATE (FLOOR (PAY_DT), 'YYYYMMDD')as KEY_PERIODO_PAY,
  DATE (FLOOR (PAY_DT), 'YYYYMMDD')as FECHA_GESTION_PAY

But then how could I modify the Master Calendar code? It would work like this?

LK_DATE_TMP:

LOAD *,

  DATE( MAKEDATE(ID_TIE_AÑO,ID_TIE_MES,ID_TIE_DIA),'YYYYMMDD') AS KEY_PERIODO,

  DATE( MAKEDATE(ID_TIE_AÑO,ID_TIE_MES,ID_TIE_DIA),'YYYYMMDD') AS KEY_PERIODO_PAY,

MASTER_CALENDAR:

NOCONCATENATE

LOAD DISTINCT *

RESIDENT LK_FECHA_TMP

WHERE EXISTS(FECHA_GESTION,ID_TIE_FECHA)

AND EXISTS(FECHA_GESTION_PAY,ID_TIE_FECHA);

I really need your help with this!

Thank you!!!

Labels (1)
3 Replies
Anonymous
Not applicable

If I have to deal with multiple date fields I typically make a Master Calendar for each date field.  You can speed up this process by using an already defined Sub Function that builds the Calendar for you.  You can find a very good one here " code.google.com/p/qlikview-components/  ". 

Anonymous
Not applicable

also the Qlikview Deployment Framework has a very good function to create date dimensions.

QlikView Deployment Framework