<?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 with group of two rows in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26882#M604522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I didn't test this:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Field1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Date&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;if(Field1 = peek('Field1'),Value&lt;/SPAN&gt;-Peek('&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;Value'&lt;/SPAN&gt;),Value) as &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;ExpectedValue&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;resident MyTable&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;order by Field1&amp;nbsp; asc,Date asc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2018 12:49:23 GMT</pubDate>
    <dc:creator>m_woolf</dc:creator>
    <dc:date>2018-06-14T12:49:23Z</dc:date>
    <item>
      <title>Peek with group of two rows</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26881#M604521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use the peek function to sustract the previous value without success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do is obtain the value from the expected value column. However, for the third line I am getting a 1 (6-5) instead of getting the first value of the second Field 1=2, as i understand that I am missing an aggregation by Field1 or something like that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 345px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="48"&gt;Field1&lt;/TD&gt;&lt;TD width="75"&gt;Date&lt;/TD&gt;&lt;TD width="118"&gt;Value&lt;/TD&gt;&lt;TD width="104"&gt;ExpectedValue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;01/01/2017&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;01/01/2018&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;01/01/2017&lt;/TD&gt;&lt;TD align="right"&gt;6&lt;/TD&gt;&lt;TD align="right"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;01/01/2018&lt;/TD&gt;&lt;TD align="right"&gt;9&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query I am using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Field1&lt;/P&gt;&lt;P&gt;Date&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Value&lt;/SPAN&gt;-Peek(&lt;SPAN style="font-size: 13.3333px;"&gt;Value&lt;/SPAN&gt;)) as &lt;SPAN style="font-size: 13.3333px;"&gt;ExpectedValue&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;resident MyTable&lt;/P&gt;&lt;P&gt;order by Field1&amp;nbsp; asc&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 11:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26881#M604521</guid>
      <dc:creator>lanlizgu</dc:creator>
      <dc:date>2018-06-14T11:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Peek with group of two rows</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26882#M604522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I didn't test this:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Field1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Date&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;if(Field1 = peek('Field1'),Value&lt;/SPAN&gt;-Peek('&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;Value'&lt;/SPAN&gt;),Value) as &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;ExpectedValue&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;resident MyTable&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;order by Field1&amp;nbsp; asc,Date asc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 12:49:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26882#M604522</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2018-06-14T12:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Peek with group of two rows</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26883#M604523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;may be&lt;/P&gt;&lt;OL class="dp-c" start="1" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; list-style-position: initial; list-style-image: initial; color: #5c5c5c; margin: 0 0 1px 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;left join(A)&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;LOAD&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filed1,&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if([Field1] = Previous([Field1]), [Value] - Previous([Value])) as Exp&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;Resident&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;Order by Date, Field1;&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 12:51:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26883#M604523</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2018-06-14T12:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Peek with group of two rows</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26884#M604524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load*,&lt;/P&gt;&lt;P&gt;if(peek(Field1)&amp;lt;&amp;gt;Field1,Value,Value-peek(Value)) as ExpectedValue&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;LOAD * inline [&lt;/P&gt;&lt;P&gt;Field1, Date, Value&lt;/P&gt;&lt;P&gt;1, 01/01/2017, 3&lt;/P&gt;&lt;P&gt;1, 01/01/2018, 5&lt;/P&gt;&lt;P&gt;2, 01/01/2017, 6&lt;/P&gt;&lt;P&gt;2, 01/01/2018, 9&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 12:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26884#M604524</guid>
      <dc:creator>jaumecf23</dc:creator>
      <dc:date>2018-06-14T12:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Peek with group of two rows</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26885#M604525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Jaume, working correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 14:54:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-with-group-of-two-rows/m-p/26885#M604525</guid>
      <dc:creator>lanlizgu</dc:creator>
      <dc:date>2018-06-14T14:54:37Z</dc:date>
    </item>
  </channel>
</rss>

