<?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 Previous and Peek not working. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Previous-and-Peek-not-working/m-p/1901548#M74379</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having trouble getting Previous and Peek to work on a simple data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to get the cumulative Minutes in the production plan as a start.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for some reason the extract I get seems to stop cumulating after the 2nd row!&lt;/P&gt;
&lt;P&gt;Red is what Qlik is giving me at present, green is what I'm after.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-06 at 00.37.19.png" style="width: 888px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/73737i8A6FA9AF87DEFE78/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-06 at 00.37.19.png" alt="Screenshot 2022-03-06 at 00.37.19.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;PlanTMP:&lt;BR /&gt;LOAD&lt;BR /&gt;Machine,&lt;BR /&gt;timestamp("Sched. start") as "Sched. start", &lt;BR /&gt;Plan_Minutes&lt;BR /&gt;FROM [lib://QLIK-DATA/CSV/INJECTION.csv]&lt;BR /&gt;(txt, codepage is 28591, embedded labels, delimiter is ',', msq) ;&lt;BR /&gt;&lt;BR /&gt;Plan:&lt;BR /&gt;Load&lt;BR /&gt;*,&lt;BR /&gt;if(previous(Machine)&amp;lt;&amp;gt;Machine,Plan_Minutes,peek(Plan_Minutes)+Plan_Minutes) as [Machine Check],&amp;nbsp;&lt;BR /&gt;if(previous(Machine)=Machine,peek(Plan_Minutes)+Plan_Minutes,Plan_Minutes) as Cumulative&lt;BR /&gt;&lt;BR /&gt;Resident PlanTMP Order by Machine,"Sched. start" asc;&lt;/P&gt;
&lt;P&gt;DROP Table PlanTMP;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2022 00:39:28 GMT</pubDate>
    <dc:creator>itatspectrum</dc:creator>
    <dc:date>2022-03-06T00:39:28Z</dc:date>
    <item>
      <title>Previous and Peek not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-and-Peek-not-working/m-p/1901548#M74379</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having trouble getting Previous and Peek to work on a simple data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to get the cumulative Minutes in the production plan as a start.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for some reason the extract I get seems to stop cumulating after the 2nd row!&lt;/P&gt;
&lt;P&gt;Red is what Qlik is giving me at present, green is what I'm after.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-06 at 00.37.19.png" style="width: 888px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/73737i8A6FA9AF87DEFE78/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-06 at 00.37.19.png" alt="Screenshot 2022-03-06 at 00.37.19.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;PlanTMP:&lt;BR /&gt;LOAD&lt;BR /&gt;Machine,&lt;BR /&gt;timestamp("Sched. start") as "Sched. start", &lt;BR /&gt;Plan_Minutes&lt;BR /&gt;FROM [lib://QLIK-DATA/CSV/INJECTION.csv]&lt;BR /&gt;(txt, codepage is 28591, embedded labels, delimiter is ',', msq) ;&lt;BR /&gt;&lt;BR /&gt;Plan:&lt;BR /&gt;Load&lt;BR /&gt;*,&lt;BR /&gt;if(previous(Machine)&amp;lt;&amp;gt;Machine,Plan_Minutes,peek(Plan_Minutes)+Plan_Minutes) as [Machine Check],&amp;nbsp;&lt;BR /&gt;if(previous(Machine)=Machine,peek(Plan_Minutes)+Plan_Minutes,Plan_Minutes) as Cumulative&lt;BR /&gt;&lt;BR /&gt;Resident PlanTMP Order by Machine,"Sched. start" asc;&lt;/P&gt;
&lt;P&gt;DROP Table PlanTMP;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 00:39:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-and-Peek-not-working/m-p/1901548#M74379</guid>
      <dc:creator>itatspectrum</dc:creator>
      <dc:date>2022-03-06T00:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Previous and Peek not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Previous-and-Peek-not-working/m-p/1901561#M74382</link>
      <description>&lt;P&gt;Hi, you need to add the the previous cumulative, not the plan_minutes:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if(previous(Machine)=Machine,peek(&lt;STRONG&gt;Cumulative&lt;/STRONG&gt;)+Plan_Minutes,Plan_Minutes) as Cumulative&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I also use Rangesum() that converts Nulls to zero:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if(previous(Machine)=Machine,Rangesum(peek(&lt;STRONG&gt;Cumulative&lt;/STRONG&gt;),Plan_Minutes),Plan_Minutes) as Cumulative&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 07:42:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Previous-and-Peek-not-working/m-p/1901561#M74382</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-03-06T07:42:56Z</dc:date>
    </item>
  </channel>
</rss>

