<?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 Question regarding peek/previous in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481379#M1128648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG __jive_id="50419" alt="Trip Table.PNG.png" class="jive-image" src="/legacyfs/online/50419_Trip Table.PNG.png" style="width: 620px; height: 250px;" /&gt;&lt;/P&gt;&lt;P&gt;Hi. See the attached image/spreadhseet. I want to load the data shown on the left to create a table shown on the right.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New fields highlighted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Duration is calculated by taking start time from NEXT trip from start time from CURRENT trip, except for last item each day, where start time and end time are the same, and duration is 0 (shown in Red).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know Qlikview does not do NEXT, so my plan was to load in descending order, then use PEEK/PREVIOUS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I need help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="50418" alt="Trip Table Script.PNG.png" class="jive-image" src="/legacyfs/online/50418_Trip Table Script.PNG.png" style="width: 620px; height: 304px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Dec 2013 11:37:24 GMT</pubDate>
    <dc:creator>mazacini</dc:creator>
    <dc:date>2013-12-13T11:37:24Z</dc:date>
    <item>
      <title>Question regarding peek/previous</title>
      <link>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481379#M1128648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG __jive_id="50419" alt="Trip Table.PNG.png" class="jive-image" src="/legacyfs/online/50419_Trip Table.PNG.png" style="width: 620px; height: 250px;" /&gt;&lt;/P&gt;&lt;P&gt;Hi. See the attached image/spreadhseet. I want to load the data shown on the left to create a table shown on the right.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New fields highlighted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Duration is calculated by taking start time from NEXT trip from start time from CURRENT trip, except for last item each day, where start time and end time are the same, and duration is 0 (shown in Red).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know Qlikview does not do NEXT, so my plan was to load in descending order, then use PEEK/PREVIOUS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I need help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="50418" alt="Trip Table Script.PNG.png" class="jive-image" src="/legacyfs/online/50418_Trip Table Script.PNG.png" style="width: 620px; height: 304px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 11:37:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481379#M1128648</guid>
      <dc:creator>mazacini</dc:creator>
      <dc:date>2013-12-13T11:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding peek/previous</title>
      <link>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481380#M1128649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would make things easier if you post your script code as text, not as image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would create the DropStart Timestamp from Date + ATA, and I would also remove single quotes from the first previous() function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Duration:&lt;/P&gt;&lt;P&gt;LOAD Date(Date,'DD/MM/YYYY') &amp;amp;Trip as DateTripCode,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Crew 1],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Crew 2],&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp(Date + ATA) as DropStart, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Location Ref]&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[Trip Table_2.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Duration2:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(DateTripCode = &lt;STRONG&gt;previous(DateTripCode),&lt;/STRONG&gt; previous(DropStart),DropStart) as DropEnd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Resident Duration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order by DateTripCode, DropStart desc;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;drop table Duration;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 11:53:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481380#M1128649</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-12-13T11:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Question regarding peek/previous</title>
      <link>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481381#M1128650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks for your response - worked perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As regards posting my script as image - I don't seem to be able to paste the text into my message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know why. In fact, when I try and paste text, nothing appears, and it seems to disable the message area!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 12:22:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-regarding-peek-previous/m-p/481381#M1128650</guid>
      <dc:creator>mazacini</dc:creator>
      <dc:date>2013-12-13T12:22:09Z</dc:date>
    </item>
  </channel>
</rss>

