<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IntervalMatch with a JOIN in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1592225#M737696</link>
    <description>&lt;P&gt;Dates in QV can be a bit painful (in my opinion).&lt;/P&gt;&lt;P&gt;I did have a look at interval match as well&amp;nbsp; - need to be careful with the ranges - but below should basically do the same;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;fact:
LOAD * INLINE [
    OrderDate, TerritoryID
    01/01/2019, 1
    01/02/2019, 1
    01/01/2019, 2
];

dim:
LOAD * INLINE [
 TerritoryID, EmployeeID, StartDate, EndDate
	1, 1, 15/12/2018, 14/01/2019
	1, 2, 15/01/2019, 14/02/2019
	2, 3, 15/12/2018, 14/01/2019
];

interval_match:
NoConcatenate
IntervalMatch( OrderDate, TerritoryID)
Load 
	StartDate, 
	EndDate,
	TerritoryID
Resident dim;

left join (interval_match)
Load
	*
Resident dim;

DROP Tables fact, dim;&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 14 Jun 2019 20:51:29 GMT</pubDate>
    <dc:creator>chrismarlow</dc:creator>
    <dc:date>2019-06-14T20:51:29Z</dc:date>
    <item>
      <title>IntervalMatch with a JOIN</title>
      <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591520#M737691</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have two tables:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; One has an OrderDate and a TerritoryID (fact table)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; The other has a TerritoryID, EmployeeID, StartDate and EndDate (dim table).&lt;BR /&gt;&lt;BR /&gt;I want to join the two tables based on territory, but also the start and end dates need to be between the OrderDate (SCD).&lt;BR /&gt;I tried interval matching with a resident load and joining it to the fact table and I also checked all the other forum answers, but none worked as I wanted it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm still a Qlik novice and I hope you understand what I'm wondering.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:18:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591520#M737691</guid>
      <dc:creator>de</dc:creator>
      <dc:date>2024-11-16T03:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch with a JOIN</title>
      <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591813#M737692</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You could try the toy script below. I think in theory an interval match should also be possible, but can be hard to follow (I find them hard to follow), this may be less efficient, but if it works ...&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;fact:
LOAD * INLINE [
    OrderDate, TerritoryID
    01/01/2019, 1
    01/02/2019, 1
    01/01/2019, 2
];

dim:
LOAD * INLINE [
 TerritoryID, EmployeeID, StartDate, EndDate
	1, 1, 15/12/2018, 15/01/2019
	1, 2, 15/01/2019, 15/02/2019
	2, 3, 15/12/2018, 15/01/2019
];

left join (fact)
Load
	*
Resident dim;

fact_final:
NoConcatenate
Load
	*
Resident fact
Where OrderDate&amp;gt;StartDate and OrderDate&amp;lt;=EndDate;

Drop tables fact, dim;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 19:12:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591813#M737692</guid>
      <dc:creator>chrismarlow</dc:creator>
      <dc:date>2019-06-13T19:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch with a JOIN</title>
      <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591893#M737693</link>
      <description>&lt;P&gt;Hi, Chris!&lt;BR /&gt;&lt;BR /&gt;Thank you a lot for your reply, I also tried something similar myself earlier.&amp;nbsp;&lt;BR /&gt;The problem is it doesn't work. Copying your script also results in an empty fact table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 06:46:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591893#M737693</guid>
      <dc:creator>de</dc:creator>
      <dc:date>2019-06-14T06:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch with a JOIN</title>
      <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591910#M737694</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Oddly I didn't get an empty table.&lt;/P&gt;&lt;P&gt;My date settings (in the auto generated bit at the top of the script I have not posted) are DD/MM/YYYY, may be the issue if yours are different.&lt;/P&gt;&lt;P&gt;I will put up screenshots/QVW later.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Chris.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 07:21:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591910#M737694</guid>
      <dc:creator>chrismarlow</dc:creator>
      <dc:date>2019-06-14T07:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch with a JOIN</title>
      <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591950#M737695</link>
      <description>&lt;P&gt;Yes, you are right!&lt;BR /&gt;The dates were the problem and your solution worked perfectly!&lt;BR /&gt;THANK YOU!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 08:25:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1591950#M737695</guid>
      <dc:creator>de</dc:creator>
      <dc:date>2019-06-14T08:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: IntervalMatch with a JOIN</title>
      <link>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1592225#M737696</link>
      <description>&lt;P&gt;Dates in QV can be a bit painful (in my opinion).&lt;/P&gt;&lt;P&gt;I did have a look at interval match as well&amp;nbsp; - need to be careful with the ranges - but below should basically do the same;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;fact:
LOAD * INLINE [
    OrderDate, TerritoryID
    01/01/2019, 1
    01/02/2019, 1
    01/01/2019, 2
];

dim:
LOAD * INLINE [
 TerritoryID, EmployeeID, StartDate, EndDate
	1, 1, 15/12/2018, 14/01/2019
	1, 2, 15/01/2019, 14/02/2019
	2, 3, 15/12/2018, 14/01/2019
];

interval_match:
NoConcatenate
IntervalMatch( OrderDate, TerritoryID)
Load 
	StartDate, 
	EndDate,
	TerritoryID
Resident dim;

left join (interval_match)
Load
	*
Resident dim;

DROP Tables fact, dim;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Jun 2019 20:51:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IntervalMatch-with-a-JOIN/m-p/1592225#M737696</guid>
      <dc:creator>chrismarlow</dc:creator>
      <dc:date>2019-06-14T20:51:29Z</dc:date>
    </item>
  </channel>
</rss>

