<?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: Merging dates during Load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060042#M354949</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great! I've already figured out a similar solution, but mine has more steps.&lt;/P&gt;&lt;P&gt;Thank you Sunny T!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 May 2016 07:14:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-05-04T07:14:32Z</dc:date>
    <item>
      <title>Merging dates during Load</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060040#M354947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table with CustomerID, Contract Start Date and Contract End Date fields.&lt;/P&gt;&lt;P&gt;One Customer can have multiple following contracts.&lt;/P&gt;&lt;P&gt;I need to merge rows where the gap between an older and a newer contract is &amp;lt;= 3 days. Contracts with longer gap should not be merged. Here is an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/123370_pastedImage_2.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;Rows 2-4 and 5-6 should be merged. The result should look like this:&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/123380_pastedImage_4.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've already tried to merge rows using resident load and Min/Max functions, but I have no idea how and where to define the condition of &amp;lt;=3 days. Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/123381_pastedImage_5.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;Thank You!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 09:37:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060040#M354947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-03T09:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Merging dates during Load</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060041#M354948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For this specific data the below script might work. But I think this might not work with your actual data. Would you be able to add more data to your sample?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RowNo, CustomerID, StartDate, EndDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, 1, 01.01.2008, 31.12.2008&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 1, 05.01.2009, 31.12.2009&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3, 1, 02.01.2010, 31.12.2010&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4, 1, 01.01.2011, 21.12.2011&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5, 2, 01.01.2012, 31.12.2012&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6, 2, 01.01.2013, 31.12.2013&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Temp:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(CustomerID = Peek('CustomerID'), Peek('StartDate')) - EndDate as Diff&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By CustomerID, StartDate desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD CustomerID,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date(Min(StartDate)) as StartDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date(Max(EndDate)) as EndDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Diff &amp;lt;= 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By CustomerID;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Concatenate(FinalTable)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD CustomerID,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; StartDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; EndDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Diff &amp;gt; 3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalFinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD RowNo() as RowNo,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident FinalTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Tables Table, Temp, FinalTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 15:09:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060041#M354948</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-03T15:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Merging dates during Load</title>
      <link>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060042#M354949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great! I've already figured out a similar solution, but mine has more steps.&lt;/P&gt;&lt;P&gt;Thank you Sunny T!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 07:14:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Merging-dates-during-Load/m-p/1060042#M354949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-04T07:14:32Z</dc:date>
    </item>
  </channel>
</rss>

