Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have two tables, Summary table , and headcout overview
Summary table having Summary_Date and headcount overview having headcount_Date.
here the date field is converted as MMM-YYYY formatted.
My requirement is if i select date like Sep-2024 then it will reflect in both tables data.
Can you please suggest me how to create Master calendar using two date filed.
Thanks & Regards,
Lakshman
Hi,
There are 2 ways,
Concatenate the both tables
or
Do Link table concept
Concatenate:
SUMMARY:
Load Date,
Lets say you have date with format like below, you should be able to create a calndar :
Summary:
Load *,
Num(Date#(Contract_Date, 'DD-MMM-YYYY')) as %DateKey
;
LOAD * inline [
Contract_ID,Contract_Date, Contract_Value
1001,23-Jan-23,10000
1002,1-Feb-22,20000
1003,1-Mar-24,4622
];
Headcount:
Load *,
Num(Date#(JoinDate, 'DD-MMM-YYYY')) as %DateKey
;
LOAD * inline [
Customer,JoinDate
A,05-Jan-23
B,01-AUG-22
C,01-SEP-24
D,01-JUL-24
E,11-MAY-23
];
//----------------------------------------------------------------------------//
//Prepare Calendar from the above dates
Calendar_Temp:
Load Num(Date#(Contract_Date, 'DD-MMM-YYYY')) as Date
resident Summary;
Load Num(Date#(JoinDate, 'DD-MMM-YYYY')) as Date
resident Headcount;
MinMax:
LOAD
Min(Date) as MinDate,
Max(Date) as MaxDate
RESIDENT Calendar_Temp;
let vMinDate = num(peek('MinDate', 0, 'MinMax'));
let vMaxDate = num(peek('MaxDate', 0, 'MinMax'));
Calendar:
Load
Num(Date(DateNum, 'DD-MMM-YYYY')) as %DateKey,
Date#(Date(DateNum), 'DD-MMM-YYYY') as Date,
Month(DateNum) as Month,
Year(DateNum) as Year,
Month(DateNum) & '-' & Year(DateNum) as MonthYear;
Load distinct
$(vMinDate) + IterNo() - 1 as DateNum
AutoGenerate 1
While $(vMinDate) + IterNo() - 1 <= $(vMaxDate);
drop table MinMax;
drop table Calendar_Temp;
There are several other ways to create a calendar, but this one should be able to give a basic idea. if the fact tables are a bit complex with different data granularities then the complexity of creating calendar also differs.
Check for my other solution: https://community.qlik.com/t5/App-Development/Issue-with-Multiple-Date-dimensions-How-to-handle-the-...
Hi Qrishna,
Thank you for your replay.
I have two tables, Summary table , and headcout overview
Summary table having Summary_Date and headcount overview having headcount_Date.
In that Persion_ID is common filed based on the Persion_ID i provided joining.
Can you please suggest me how to handled this senario.
Thanks & Regards,
Lakshman
Hi,
There are 2 ways,
Concatenate the both tables
or
Do Link table concept
Concatenate:
SUMMARY:
Load Date,