<?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: interval match based on multiple fields and 2 resident tables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1773074#M454700</link>
    <description>&lt;P&gt;Let me think about how to explain it, even in real terms it confuses me.&amp;nbsp; I don't want to just throw the problem out there and expect someone to solve it.&amp;nbsp; hence my attempts at the qvw's&amp;nbsp; I did make progress and may have to just break it down even more than I did.&lt;/P&gt;&lt;P&gt;sorry for the confusion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jan 2021 15:30:42 GMT</pubDate>
    <dc:creator>RogerG</dc:creator>
    <dc:date>2021-01-09T15:30:42Z</dc:date>
    <item>
      <title>interval match based on multiple fields and 2 resident tables</title>
      <link>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1772948#M454685</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have 2 resident tables and trying to perform an interval match on them&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;temp:
LOAD * INLINE [
    EMP_ID, SALES_DATE
    1, 1/15/2020
    1, 2/11/2020
    1, 3/30/2020
    2, 1/11/2020
    2, 2/11/2020
    2, 3/25/2020
    3, 1/1/2020
    3, 2/11/2020
    3, 3/27/2020
];

Buckets:
LOAD * INLINE [
   EMP_ID,RANGE1, START_DATE,END_DATE
    1, E1R1, 1/16/2020, 2/28/2020
    1, E1R2, 3/1/2020,5/1/2020
    2, E2R1, 1/3/2020, 2/15/2020
   	2, E2R2, 3/1/2020, 4/15/2020
    3, E3R1, 1/5/2020, 2/1/2020
    3, E3R2, 3/1/2020,3/15/2020
    
];
inner join
IntervalMatch(SALES_DATE, EMP_ID) Load  START_DATE,END_DATE, EMP_ID
Resident Buckets;
INNER JOIN 
load * 
resident Buckets;
drop table temp;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I this code should only look at the month and year of the sales date and ranges to determine which RANGE1 is assinged.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would hope to see&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;EMP_ID&lt;/TD&gt;&lt;TD&gt;SALES_DATE&lt;/TD&gt;&lt;TD&gt;RANGE1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;1/15/2020&lt;/TD&gt;&lt;TD&gt;E1R1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;2/11/2020&lt;/TD&gt;&lt;TD&gt;E1R1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;3/30/2020&lt;/TD&gt;&lt;TD&gt;E1R2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;1/11/2020&lt;/TD&gt;&lt;TD&gt;E2R1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;2/11/2020&lt;/TD&gt;&lt;TD&gt;E2R1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2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2/11/2020&lt;/TD&gt;&lt;TD&gt;E1R1&lt;/TD&gt;&lt;TD&gt;1/16/2020&lt;/TD&gt;&lt;TD&gt;2/28/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2/11/2020&lt;/TD&gt;&lt;TD&gt;E2R1&lt;/TD&gt;&lt;TD&gt;1/3/2020&lt;/TD&gt;&lt;TD&gt;2/15/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2/11/2020&lt;/TD&gt;&lt;TD&gt;E2R2&lt;/TD&gt;&lt;TD&gt;3/1/2020&lt;/TD&gt;&lt;TD&gt;4/15/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2/11/2020&lt;/TD&gt;&lt;TD&gt;E3R2&lt;/TD&gt;&lt;TD&gt;3/1/2020&lt;/TD&gt;&lt;TD&gt;3/15/2020&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 08 Jan 2021 20:35:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1772948#M454685</guid>
      <dc:creator>RogerG</dc:creator>
      <dc:date>2021-01-08T20:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: interval match based on multiple fields and 2 resident tables</title>
      <link>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1772971#M454688</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/95702"&gt;@RogerG&lt;/a&gt;, whit that code i get this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_0-1610132684731.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46665i99BA59489666EED8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_0-1610132684731.png" alt="rubenmarin_0-1610132684731.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Which is ok based on the ranges and different from what you get¿?&lt;/P&gt;&lt;P&gt;In your post you expect to return E1R1 for emp1 on sales date 1/15/2020 but this date is outside the defined ranges, and that's the reason it wil not assign E1R1.&lt;/P&gt;&lt;P&gt;The file has a different code... I don't really understand the issue or your needs, intervalmatch will relate each sales date in the range set between start_date and end_date by emp_id.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 19:08:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1772971#M454688</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2021-01-08T19:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: interval match based on multiple fields and 2 resident tables</title>
      <link>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1772995#M454689</link>
      <description>&lt;P&gt;you are correct, I did a bad job in describing my issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a new upload, ignore the other one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;high level sumary&lt;/P&gt;&lt;P&gt;1 - I have a sales person list with dates, not all dates are important, but they all need to be maintained&lt;/P&gt;&lt;P&gt;2 - I am converting the single list of dates to a start and finish based on the dates in bullet 1, these will make up the sales date ranges, they are grouped by the person, not the entry id in the system.&lt;/P&gt;&lt;P&gt;3 - I have costs are are attached to the entry ID, I needed to find a way to convert that to the sales person not the ID, so I could tie those the ranges.&lt;/P&gt;&lt;P&gt;4 - the costs need to be grouped by the RANGE1 within the sales range&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 20:31:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1772995#M454689</guid>
      <dc:creator>RogerG</dc:creator>
      <dc:date>2021-01-08T20:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: interval match based on multiple fields and 2 resident tables</title>
      <link>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1773042#M454692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/95702"&gt;@RogerG&lt;/a&gt;, I have readed it more than 3 times and still don't get it, maybe it will be clearer if you just set the inline tables with your original data and the desired final table.&lt;/P&gt;&lt;P&gt;In case it help ranges can be created as:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EMP_SALES_RANGE:
 LOAD
 	EMP_NAME, 
 	EMP_STATUS,
 	EMP_STATUS_ORDER,
 	TARGET_SALES_DATES AS START_SALES_RANGE,
 	If(EMP_NAME=Peek(EMP_NAME)
 	  ,date(PEEK(START_SALES_RANGE)-1)
 	  ,date(Floor(YearEnd(MakeDate(9999))))
 	) AS END_SALES_RANGE // this date is coming in on my real app
 RESIDENT TEMP 
  WHERE EMP_STATUS_ORDER &amp;lt;&amp;gt; NULL()
 ORDER BY EMP_NAME, EMP_STATUS_ORDER DESC;&lt;/LI-CODE&gt;&lt;P&gt;Note that i substract one to create end date, this is to avoid the same date in two different ranges (on one as end and on the other as start).&lt;/P&gt;&lt;P&gt;Still I don't know where the date of this line come from:&amp;nbsp;22, SAM, E, 3/25/2020&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 10:02:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1773042#M454692</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2021-01-09T10:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: interval match based on multiple fields and 2 resident tables</title>
      <link>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1773074#M454700</link>
      <description>&lt;P&gt;Let me think about how to explain it, even in real terms it confuses me.&amp;nbsp; I don't want to just throw the problem out there and expect someone to solve it.&amp;nbsp; hence my attempts at the qvw's&amp;nbsp; I did make progress and may have to just break it down even more than I did.&lt;/P&gt;&lt;P&gt;sorry for the confusion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 15:30:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/interval-match-based-on-multiple-fields-and-2-resident-tables/m-p/1773074#M454700</guid>
      <dc:creator>RogerG</dc:creator>
      <dc:date>2021-01-09T15:30:42Z</dc:date>
    </item>
  </channel>
</rss>

