<?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: peek function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/peek-function/m-p/1856011#M1215892</link>
    <description>&lt;P&gt;You need also to add a proper &lt;STRONG&gt;order by&lt;/STRONG&gt; statement to your resident-load to ensure that the order of the records are sorted in your intended way.&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Fri, 05 Nov 2021 12:03:33 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2021-11-05T12:03:33Z</dc:date>
    <item>
      <title>peek function</title>
      <link>https://community.qlik.com/t5/QlikView/peek-function/m-p/1855537#M1215857</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;
&lt;P&gt;im using the peek function to grab the max date of the previous order and comparing this against the min date of the next order. it seems to work for some orders but not for others. im grouping my data by order, part and line,&amp;nbsp; in a previous table, then im resident loading that table in again to get the "ChangeoverTime"to give the user flexibility if they want to select a specific part or line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my code is:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;final1:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;min(SGRP.MinDate) as Min.Id, max(SGRP.MaxDate) as Max.Id&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;order, line , part&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;from x&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;group by order, line , part&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;final2:&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;&amp;nbsp;Min.Id - peek('Max.Id') as ChangeoverTime,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;Min.Id, Max.Id, PART, order, line.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;resident final1&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;EM&gt;drop table final1;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i want from my output is that a user can select a line and/or part, and it will show them all the changeover time from the min of one batch, to the max of the previous batch for that part or line.&lt;/P&gt;
&lt;P&gt;this is what im getting:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maarcus_smith_2-1636031177498.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/65924i2DAB14FC5DAE1BDB/image-size/large?v=v2&amp;amp;px=999" role="button" title="maarcus_smith_2-1636031177498.png" alt="maarcus_smith_2-1636031177498.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as you can see, most of the lines are correct, however the highlighted one is wrong. the changeover time should be null for this field as there is no previous order on that line, however, its taking the max id of the order on line 10 for some reason.&lt;/P&gt;
&lt;P&gt;how do i correct this to where for the first order on each line or part, the changeover is null?&lt;/P&gt;
&lt;P&gt;many thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 13:11:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/peek-function/m-p/1855537#M1215857</guid>
      <dc:creator>maarcus_smith</dc:creator>
      <dc:date>2021-11-04T13:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: peek function</title>
      <link>https://community.qlik.com/t5/QlikView/peek-function/m-p/1855596#M1215859</link>
      <description>&lt;P&gt;If(line = peek('line'), Min.Id - peek('Max.Id'), null()) as ChangeoverTime&lt;/P&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 14:54:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/peek-function/m-p/1855596#M1215859</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2021-11-04T14:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: peek function</title>
      <link>https://community.qlik.com/t5/QlikView/peek-function/m-p/1855619#M1215860</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6148"&gt;@rwunderlich&lt;/a&gt;&amp;nbsp; hi rob thanks for answering me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ive tried updating my peek function with your adivce, however it doesn't seem to have the desired affect, it makes some of my changeover times nulls but then there are still some minus'. however there are minus' not because of the line changing and i dont understand why, see the&amp;nbsp; highlighted rows&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maarcus_smith_0-1636039984900.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/65938i4B2B4F3C8AA9D1B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="maarcus_smith_0-1636039984900.png" alt="maarcus_smith_0-1636039984900.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maarcus_smith_1-1636040111208.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/65939iA734BC5502BAE7D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="maarcus_smith_1-1636040111208.png" alt="maarcus_smith_1-1636040111208.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 15:35:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/peek-function/m-p/1855619#M1215860</guid>
      <dc:creator>maarcus_smith</dc:creator>
      <dc:date>2021-11-04T15:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: peek function</title>
      <link>https://community.qlik.com/t5/QlikView/peek-function/m-p/1856011#M1215892</link>
      <description>&lt;P&gt;You need also to add a proper &lt;STRONG&gt;order by&lt;/STRONG&gt; statement to your resident-load to ensure that the order of the records are sorted in your intended way.&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 12:03:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/peek-function/m-p/1856011#M1215892</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-11-05T12:03:33Z</dc:date>
    </item>
  </channel>
</rss>

