Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to join two dates to calendar date?

Hi,

I have two columns DateEntered and DateProcessed. I need to join these two dates to calendar date. How can I do this in script. Please see below as I have this in tables

TblTemp:
LOAD
     ID,
    
   
     Date(DateEntered,'DD/MM/YYYY')                                             as  DateEntered,
    
     Date(DateProcessed,'DD/MM/YYYY')                                           as  DateProcessed
   

FROM
[Table.qvd]
(qvd);

TblTemp1:
LOAD *,
IF(ID = PREVIOUS (ID),1,0)              as Flag1
RESIDENT
TblTemp
ORDER BY ID ASC,DateEntered ASC;

Tbl:
LOAD *,
IF(ID = PREVIOUS (ID) AND Order <> Previous(Order) , DateEntered-PREVIOUS(DateEntered1),' ') as CycleTime
RESIDENT
    TblTemp1;

DROP TABLE TblTemp;
DROP TABLE TblTemp1;

LEFT JOIN (Tbl)
 
  LOAD
  ID,
  MAX(DateEntered)                                                             as MaxDateEntered

  RESIDENT
  Tbl
  GROUP BY ID
  ORDER BY ID,DateEntered ;
 
 
  LEFT JOIN (Tbl)
 
  LOAD
  ID,
  EnteredBy                                                                     as Member
  RESIDENT TblIssue
  WHERE DateDateEntered1 = MaxDateEntered; 


Calendar:

LOAD Date                      

     Date_TS,
     Today,
     Week,
     Year,
     Text(Month)                     as Month,
     ApplyMap('SortMap',Text(Month)) as MonthSort,
     Day,
     WeekDay,
     Quarter,
     MonthYear,
     WeekYear,
     CurYTDFlag,
     LastYTDFlag,
     FiscalYear,
     FiscalYearStart,
     FiscalWeek,
     FiscalWeekSerial,
     FiscalQuarter

FROM
[Calendar.qvd]
(qvd);

Please can anyone suggest me as I tried to get this  but not seems using correct.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

This blog post may help: Why You sometimes should Load a Master Table several times


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

You need 2 calendars one for each date ...

Gysbert_Wassenaar

This blog post may help: Why You sometimes should Load a Master Table several times


talk is cheap, supply exceeds demand
maleksafa
Specialist
Specialist

Not applicable
Author

Thanks. I tried two calendars but it is not working. How to get this by joining above script? Please help

Not applicable
Author

and also when I am creating two calendars it is getting synthetic keys. Please help

Not applicable
Author

Thanks. I tried this but seems not getting to use with the data which I have. Can please help me.

Not applicable
Author

Thanks. I confused earlier. But this working exactly.