Intervalmatch example – with dates

I have two tables Table1,Table2. Table1 has DATE, Table2 has START_DT,END_DT. Want to join these two tables on DATE columns.

Intervalmatch function will help us to make the join in Qlik. If we use left join, we can avoid synthetic tables too. Here is the example.

If you want to test, prepare the test data.

Let me know if you need any more info/clarification.

Table1:
 LOAD COUNTRY,
 DATE,
 C1,
 C2
 FROM Table1;
 Table2:
 LOAD COUNTRY, C3,C4,
 date(START_DT) as START_DT,
 date(END_DT) as END_DT
 FROM Table2;
 Final_Table:
 INTERVALMATCH (DATE) left JOIN LOAD START_DT, END_DT RESIDENT Table2;

left Join (Table1) LOAD distinct * RESIDENT Table2;

DROP TABLE Table2;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.