<?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: Intervals between CretaedDate and CreatedEnd in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120783#M917213</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny is using an expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Interval(CREATED_NEW - CREATED)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and a total mode 'sum of rows'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since in general we should use aggregation functions in expressions, you could also use the default total mode 'expression total' and as expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Interval(Sum( &lt;SPAN style="font-size: 13.3333px;"&gt;CREATED_NEW - CREATED))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3779"&gt;Use Aggregation Functions!&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides this, you may need to decide how you want to handle the records with the last timestamp per SERIAL_NUM.&lt;/P&gt;&lt;P&gt;With the code suggested by Sunny, a duration of 0 will be assigned, while you may want to calculate the duration until Today() (or another max timestamp) or another value based on a logic involving the CASE_STATUS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Table:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Directory;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD SERIAL_NUM, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE_STATUS_CD, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATED&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[SampleData.xlsx]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(ooxml, embedded labels, table is Sheet1);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FinalTable:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, Interval(CREATED_END - CREATED) as DURATION;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; If(SERIAL_NUM = Previous(SERIAL_NUM), Previous(CREATED), TODAY()) as CREATED_END&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Table&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Order By SERIAL_NUM, CREATED desc;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table Table;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's also explained in detail in this blog and the linked tech doc:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2960"&gt;Creating a Date Interval from a Single Date&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 22 May 2016 10:03:02 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2016-05-22T10:03:02Z</dc:date>
    <item>
      <title>Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120780#M917210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I would like to do the lag calculation for Historical data in Qlikview.I would like to have a new column (new expression?) with the count differences between current day and the days before for every case Status 4/15/2013&amp;nbsp; 12:42:23 PM - 4/17/2013&amp;nbsp; 9:17:12 AM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the attachment of excel file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/125337_Capture.PNG" style="height: auto;" /&gt;&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/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120780#M917210</guid>
      <dc:creator>sreeni_qvd</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120781#M917211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="125340" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/125340_Capture.PNG" style="height: auto;" /&gt;&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 SERIAL_NUM, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE_STATUS_CD, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATED&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[SampleData (2).xlsx]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Sheet1);&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 *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(SERIAL_NUM = Previous(SERIAL_NUM), Previous(CREATED), CREATED) as CREATED_NEW&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 SERIAL_NUM, CREATED desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 06:14:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120781#M917211</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-22T06:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120782#M917212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes this is the correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what is the expression did you used for total count (566:25:25 PM)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 07:05:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120782#M917212</guid>
      <dc:creator>sreeni_qvd</dc:creator>
      <dc:date>2016-05-22T07:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120783#M917213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny is using an expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Interval(CREATED_NEW - CREATED)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and a total mode 'sum of rows'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since in general we should use aggregation functions in expressions, you could also use the default total mode 'expression total' and as expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Interval(Sum( &lt;SPAN style="font-size: 13.3333px;"&gt;CREATED_NEW - CREATED))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3779"&gt;Use Aggregation Functions!&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides this, you may need to decide how you want to handle the records with the last timestamp per SERIAL_NUM.&lt;/P&gt;&lt;P&gt;With the code suggested by Sunny, a duration of 0 will be assigned, while you may want to calculate the duration until Today() (or another max timestamp) or another value based on a logic involving the CASE_STATUS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Table:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Directory;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD SERIAL_NUM, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE_STATUS_CD, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATED&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[SampleData.xlsx]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(ooxml, embedded labels, table is Sheet1);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FinalTable:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, Interval(CREATED_END - CREATED) as DURATION;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; If(SERIAL_NUM = Previous(SERIAL_NUM), Previous(CREATED), TODAY()) as CREATED_END&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Table&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Order By SERIAL_NUM, CREATED desc;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table Table;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's also explained in detail in this blog and the linked tech doc:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2960"&gt;Creating a Date Interval from a Single Date&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 10:03:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120783#M917213</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-22T10:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120784#M917214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So as Stefan has already mentioned that I used the Total Mode feature within straight table to get the sum of rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/125352_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Pivot table options are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan's provided -&amp;gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;=Interval(Sum( &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;CREATED_NEW - CREATED))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;or may be based on Aggr() using some combination of dimension if the chart is more complex then the one we have proposed above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, the script can be tweaked to default to any date (not just today) for the last timestamp. But based on the image you posted, I would assume that you did want to default it to the same time so that you see a 0. Let us know if that is not the case and we can always offer another solution (if Stefan's or my solution doesn't work for you)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 13:49:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120784#M917214</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-22T13:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120785#M917215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you explain the logic of the calculated columns in your screenshot sample?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like you use a different logic per Case status, since all records belong to the same SERIAL_NUM, but CREATED_NEW is not always capturing the following timestamp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 16:21:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120785#M917215</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-22T16:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120786#M917216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class=""&gt;&lt;SPAN style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"&gt;Hey Stefan -&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"&gt;I am not next to my computer right now. So won't really be able to provide any details. But since you were willing to respond, I am sure something is def. wrong with what I have posted. I will def. look at my screenshot and get back to you &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"&gt;Sunny&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 16:27:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120786#M917216</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-22T16:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120787#M917217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny, I was actually addressing the OP to clarify what he requested / shows in the screenshot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing really wrong with your solution so far.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 16:29:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120787#M917217</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-22T16:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Intervals between CretaedDate and CreatedEnd</title>
      <link>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120788#M917218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My bad &lt;/SPAN&gt;&lt;P class=""&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2016 16:52:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Intervals-between-CretaedDate-and-CreatedEnd/m-p/1120788#M917218</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-22T16:52:43Z</dc:date>
    </item>
  </channel>
</rss>

