<?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 Combine rows with start date and end date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382300#M820995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an equipment table with start date, end date and equipment status. The dates are sequential (end date from one row is equal to the start of the next row).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this following table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Equipment,Start,End,Status&lt;/P&gt;&lt;P&gt;A,1,2,2&lt;/P&gt;&lt;P&gt;A,2,3,2&lt;/P&gt;&lt;P&gt;A,3,4,2&lt;/P&gt;&lt;P&gt;A,4,5,2&lt;/P&gt;&lt;P&gt;A,5,6,3&lt;/P&gt;&lt;P&gt;A,6,7,3&lt;/P&gt;&lt;P&gt;A,7,8,2&lt;/P&gt;&lt;P&gt;A,8,9,2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am trying to do is combine rows and get:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Table2:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Load * inline&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;[&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Equipment,Start,End,Status&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;A,1,5,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;A,5,7,3&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;A,7,9,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;];&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I tried to use:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;if(previous(status) = status,previous(start),start) as start&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;but it works only with 2 sequential rows&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;and we cant use group by min and max because we will lost the third line A,7,9,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>igorgois_</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Combine rows with start date and end date</title>
      <link>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382300#M820995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an equipment table with start date, end date and equipment status. The dates are sequential (end date from one row is equal to the start of the next row).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this following table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Equipment,Start,End,Status&lt;/P&gt;&lt;P&gt;A,1,2,2&lt;/P&gt;&lt;P&gt;A,2,3,2&lt;/P&gt;&lt;P&gt;A,3,4,2&lt;/P&gt;&lt;P&gt;A,4,5,2&lt;/P&gt;&lt;P&gt;A,5,6,3&lt;/P&gt;&lt;P&gt;A,6,7,3&lt;/P&gt;&lt;P&gt;A,7,8,2&lt;/P&gt;&lt;P&gt;A,8,9,2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am trying to do is combine rows and get:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Table2:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Load * inline&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;[&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Equipment,Start,End,Status&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;A,1,5,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;A,5,7,3&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;A,7,9,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;];&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I tried to use:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;if(previous(status) = status,previous(start),start) as start&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;but it works only with 2 sequential rows&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;and we cant use group by min and max because we will lost the third line A,7,9,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382300#M820995</guid>
      <dc:creator>igorgois_</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combine rows with start date and end date</title>
      <link>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382301#M820996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Perhaps like this:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Status&amp;lt;&amp;gt;Previous(Status), Rangesum(Peek(Group),1),Peek(Group)) as Group &lt;/P&gt;&lt;P&gt;inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Equipment,Start,End,Status&lt;/P&gt;&lt;P&gt;A,1,2,2&lt;/P&gt;&lt;P&gt;A,2,3,2&lt;/P&gt;&lt;P&gt;A,3,4,2&lt;/P&gt;&lt;P&gt;A,4,5,2&lt;/P&gt;&lt;P&gt;A,5,6,3&lt;/P&gt;&lt;P&gt;A,6,7,3&lt;/P&gt;&lt;P&gt;A,7,8,2&lt;/P&gt;&lt;P&gt;A,8,9,2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;NOCONCATENATE LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Equipment,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min(Start) as Start,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(End) as End,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group&lt;/P&gt;&lt;P&gt;RESIDENT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table1&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Equipment,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP FIELD Group;&lt;/P&gt;&lt;P&gt;DROP TABLE Table1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:20:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382301#M820996</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-08-10T16:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combine rows with start date and end date</title>
      <link>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382302#M820997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you are a life saver!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a lot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did it in a far more complex/less elegant way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Equipamento,Start,End,Status&lt;/P&gt;&lt;P&gt;A,1,2,2&lt;/P&gt;&lt;P&gt;A,2,3,2&lt;/P&gt;&lt;P&gt;A,3,4,2&lt;/P&gt;&lt;P&gt;A,4,5,2&lt;/P&gt;&lt;P&gt;A,5,6,3&lt;/P&gt;&lt;P&gt;A,6,7,3&lt;/P&gt;&lt;P&gt;A,7,8,2&lt;/P&gt;&lt;P&gt;A,8,9,2&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;RowNo() as aux&lt;/P&gt;&lt;P&gt;Resident Table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table Table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table3:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if(IsNull(&lt;/P&gt;&lt;P&gt;if(aux = aux1,previous(aux)/Previous(aux1),aux/aux1)),&lt;/P&gt;&lt;P&gt;1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(aux = aux1,previous(aux)/Previous(aux1),aux/aux1)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;as aux2;&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if(Previous(Equipamento) = Equipamento and Previous(Status) = Status,Previous(aux)+1,1) as aux1&lt;/P&gt;&lt;P&gt;Resident Table2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table Table2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Table4:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Equipamento, Start, Status, aux2&lt;/P&gt;&lt;P&gt;Resident Table3&lt;/P&gt;&lt;P&gt;where aux1 = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join(Table4)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Equipamento, &lt;/P&gt;&lt;P&gt;Status, &lt;/P&gt;&lt;P&gt;aux2,&lt;/P&gt;&lt;P&gt;max(End) as End&lt;/P&gt;&lt;P&gt;Resident Table3&lt;/P&gt;&lt;P&gt;group by Equipamento, Status, aux2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop field aux2;&lt;/P&gt;&lt;P&gt;Drop table Table3;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2017 17:29:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combine-rows-with-start-date-and-end-date/m-p/1382302#M820997</guid>
      <dc:creator>igorgois_</dc:creator>
      <dc:date>2017-08-10T17:29:27Z</dc:date>
    </item>
  </channel>
</rss>

