<?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: Calculate the days difference between a row and its previous in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529041#M482782</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jul 2013 14:41:20 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-07-26T14:41:20Z</dc:date>
    <item>
      <title>Calculate the days difference between a row and its previous</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529040#M482781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hi there,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a list of orders, the status they changed into and the date of the stauts change. I want to calculate the days that each order stayed in each status.&lt;/P&gt;&lt;P&gt;In other words the last column in the table below (the one with the red header text).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it better to do it in load time or in a straigh table for example using set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all in advance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 460px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="90"&gt;Order Id&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="68"&gt;Date&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="153"&gt;Status Description&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="149"&gt;&lt;SPAN style="color: #ff0000;"&gt;# of Days is Status&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;15/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Approved&lt;/TD&gt;&lt;TD class="xl68"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;16/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Awaiting&lt;/TD&gt;&lt;TD class="xl68"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Processing&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Finished&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;15/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Approved&lt;/TD&gt;&lt;TD class="xl68"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;21/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Awaiting&lt;/TD&gt;&lt;TD class="xl68"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Processing&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Finished&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;16/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Approved&lt;/TD&gt;&lt;TD class="xl68"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;21/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Awaiting&lt;/TD&gt;&lt;TD class="xl68"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Processing&lt;/TD&gt;&lt;TD class="xl68"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;27/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Finished&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;10/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Approved&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;10/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Awaiting&lt;/TD&gt;&lt;TD class="xl68"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Processing&lt;/TD&gt;&lt;TD class="xl68"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;26/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Finished&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25/6/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Approved&lt;/TD&gt;&lt;TD class="xl68"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;10/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Awaiting&lt;/TD&gt;&lt;TD class="xl68"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;17/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Processing&lt;/TD&gt;&lt;TD class="xl68"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;21/7/2013&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;Finished&lt;/TD&gt;&lt;TD class="xl68"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 14:20:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529040#M482781</guid>
      <dc:creator />
      <dc:date>2013-07-26T14:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the days difference between a row and its previous</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529041#M482782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 14:41:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529041#M482782</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-07-26T14:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the days difference between a row and its previous</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529042#M482783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had a similar use case and found that doing it in the script made sense for me for performance and flexibility reasons.&lt;/P&gt;&lt;P&gt;Performance - I was dealing with about 200 million records, so doing the calculations up front vs. doing calculations on the fly was the better route&lt;/P&gt;&lt;P&gt;Flexibility - Was able to use results in multiple objects in my dashboards without repeating expressions. Also was able to create buckets of days ex. 1-5 days, 6-10, etc.&amp;nbsp; using Class() . So you can ask the question: How many orders are waiting 6-10 days to be processed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 14:47:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-the-days-difference-between-a-row-and-its-previous/m-p/529042#M482783</guid>
      <dc:creator>jsakalis</dc:creator>
      <dc:date>2013-07-26T14:47:44Z</dc:date>
    </item>
  </channel>
</rss>

