Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Dealing with two dates

Hi,

I have two tables and in those two tables i use two different dates.

So i want to use common date in date filters.

say my tow dates are

Mydate   in mytable and machinedate in machine table.

I want to use common date in my calander

Thanks

3 Replies
amit_saini
Master III
Master III

Not applicable

Hi Anuradha

Try to use a MasterCalendar like this:

LET varMinDate = StartDate; eg:'6/15/2001'

LET varMaxDate = EndDate; eg: Today();

//************TempCalendar***********
TempCalendar:
LOAD
$(varMinDate) + rowno() - 1 AS DateNumber,
date ($(varMinDate) + rowno() - 1) AS TempDate
AUTOGENERATE
$(varMaxDate) - $(varMinDate) + 1;

//*************Master Calendar************
MasterCalendar:
LOAD
TempDate AS Date,
Week (TempDate) AS Week,
Year (TempDate) AS Year,
Month (TempDate) AS Month,
Day (TempDate) AS Day,
Weekday (TempDate) AS WeekDay,
'Q' & Ceil(Month (TempDate)/3) AS Quarter,
Date( Monthstart (TempDate), 'MMM-YYYY') AS MonthYear,
Week (TempDate) & '-' & Year (TempDate) AS WeekYear

Resident TempCalendar
Order by TempDate ASC;

Drop Table TempCalendar;

However if you want 2 different dates for analysis, you need 1 calendar per date...

Hope this is helpful for you!

BRGDS,

Anthony

sudeepkm
Specialist III
Specialist III

It seems you want to associate both the tables based on the date fields.

May be you can try the code below.

// create a table by loading distinct dates from both the tables and join

Tab1:

load OtherFields1,[Date Field1] as [Date Field] from tab1;

Tab2:

load OtherFields2,[Date Field2] as [Date Field] from tab2;

TempCalendar:

load Distinct [Date Field] Resident Tab1;

Join LOAD Distinct [Date Field] Resident Tab2;

MainCalendar:

load [Date Field] Resident TempCalendar;

DROP Table TempCalendar;