<?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 How to use PEEK-function with condition? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118489#M603408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="peek.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/211729_peek.jpg" style="height: 292px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;In my application, I want to fill unknown datafields with historical values from the last row with the same TagID (first column). In the actual situation the positions with the red values are empty. I filled in the red values to show what they should be.&lt;/P&gt;&lt;P&gt;A normal PEEK-function can use the data from a fixed previous record, but how to program the condition to copy from a previous record with a certain condition?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Aug 2018 10:32:39 GMT</pubDate>
    <dc:creator>rennesia</dc:creator>
    <dc:date>2018-08-24T10:32:39Z</dc:date>
    <item>
      <title>How to use PEEK-function with condition?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118489#M603408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="peek.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/211729_peek.jpg" style="height: 292px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;In my application, I want to fill unknown datafields with historical values from the last row with the same TagID (first column). In the actual situation the positions with the red values are empty. I filled in the red values to show what they should be.&lt;/P&gt;&lt;P&gt;A normal PEEK-function can use the data from a fixed previous record, but how to program the condition to copy from a previous record with a certain condition?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2018 10:32:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118489#M603408</guid>
      <dc:creator>rennesia</dc:creator>
      <dc:date>2018-08-24T10:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PEEK-function with condition?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118490#M603409</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;For the peek to work, you'll have to order your data.&lt;/P&gt;&lt;P&gt;In this case, order it by TagID and TimeStamp so you can have a table with the historic view, by TagID. like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;orderedTable:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;if(peek(TagID)=TagID,peek(MTBF),MTBF) as MTBF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Resident dataTable&lt;/P&gt;&lt;P&gt;order by TagID,TimeStamp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, you use the peek() statement to check something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(peek(TagID)=TagID,peek(MTBF),MTBF)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this if will verify if the previous tag ID is the same as the current one and then get the according MTBG value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Felipe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2018 10:45:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118490#M603409</guid>
      <dc:creator>felipedl</dc:creator>
      <dc:date>2018-08-24T10:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PEEK-function with condition?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118491#M603410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Almost an too easy solution, but it works fine! Thanks Felip!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2018 11:58:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118491#M603410</guid>
      <dc:creator>rennesia</dc:creator>
      <dc:date>2018-08-24T11:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PEEK-function with condition?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118492#M603411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad it helped &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2018 13:03:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-PEEK-function-with-condition/m-p/118492#M603411</guid>
      <dc:creator>felipedl</dc:creator>
      <dc:date>2018-08-24T13:03:04Z</dc:date>
    </item>
  </channel>
</rss>

