<?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: previous behaviour in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183099#M383168</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think Previous function always looked at the rows in the resident table and I am guessing that where statement is getting completely ignored when checking for Previous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a test to see what we get with Previous and Peek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TEST:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dim, Ver, Val&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 1, 100&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 1, 200&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 2, 120&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 2, 220&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 2, 300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 2, 310&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR x = 1 to 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tmpFinal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Dim,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Val,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Ver,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Previous(Dim) = Dim, 0, 1) as TEST,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;Previous(Dim),&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;&amp;nbsp; Peek('Dim')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TEST&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Ver = '$(x)'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By Dim, Val;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEXT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident tmpFinal&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where TEST = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/137306_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Sep 2016 15:13:03 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-09-13T15:13:03Z</dc:date>
    <item>
      <title>previous behaviour</title>
      <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183096#M383165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;I use the previous function to detect first occurences of data&lt;/P&gt;&lt;P&gt;As I donot get correct result; i made a test. I hope that someone can explain what happens&lt;/P&gt;&lt;P&gt; I would have expected this result with the scipt below (correct when i uncomment the below Expression):&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/137299_pastedImage_13.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;But I get&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&lt;IMG class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/137298_pastedImage_3.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;This is a very short example. So please no advice that I can do it easier, other way etc. I neet to understand previous function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;What I donot understand: I read in first step the first Dim A with Val 100. There is no previous record, so I get 1 for TEST&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;In next step I read Ver=2. I get two records, one with Val 120 and one with val 300. For the first record with Val=120 I would expect 1 as result for TEST&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;as there is no previous record. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;Help description: In the first record of an internal table the function will return NULL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Does Qlikview remembers that Dim A was already loaded in first part of Loop? Or even does Qlikview looks at origin (Inline) Table and detects that&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Dim A with Val 100 was first, and no change for DIM A, Ver 2 Val 120 in second part of Loop if I only use previous(Dim)??&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a small Inline table&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;TEST:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;load&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;inline&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[&lt;BR /&gt; Dim, Ver, Val&lt;BR /&gt; A, 1, 100&lt;BR /&gt; B, 1, 200&lt;BR /&gt; A, 2, 120&lt;BR /&gt; B, 2, 220&lt;BR /&gt; A, 2, 300&lt;BR /&gt; B, 2, 310&lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;What I want as result: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;In a Loop I load the Versions to test if the record is new. &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;for&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;x&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;=1 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; 2&lt;BR /&gt; &lt;BR /&gt; tmpFinal:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;load&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Val&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Ver&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;previous&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)=&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; ,0, 1) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;TEST&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//if (previous(Dim)=Dim and (Previous(Ver)=Ver) ,0, 1) as TEST&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Resident&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; TEST&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Ver&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='$(x)'&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Val&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;next&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;;&lt;BR /&gt; &lt;BR /&gt; Final:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;NoConcatenate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;load&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; *&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Resident&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; tmpFinal&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;TEST&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=1; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 14:51:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183096#M383165</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-13T14:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: previous behaviour</title>
      <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183097#M383166</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;If you always want a first occurrence then you can use the firstsortedvalue().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Link below will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/30532"&gt;FirstSortedValue()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:00:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183097#M383166</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2016-09-13T15:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: previous behaviour</title>
      <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183098#M383167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May not be relevant as you are trying to understand Previous, but Peek seems to solve the issue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TEST:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dim, Ver, Val&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 1, 100&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 1, 200&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 2, 120&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 2, 220&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 2, 300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 2, 310&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//What I want as result:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//In a Loop I load the Versions to test if the record is new.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR x = 1 to 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tmpFinal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Dim,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Val,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Ver,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(&lt;SPAN style="color: #ff0000;"&gt;Peek('Dim')&lt;/SPAN&gt; = Dim, 0, 1) as TEST&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TEST&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Ver = '$(x)'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By Dim, Val;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEXT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident tmpFinal&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where TEST = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:06:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183098#M383167</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-09-13T15:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: previous behaviour</title>
      <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183099#M383168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think Previous function always looked at the rows in the resident table and I am guessing that where statement is getting completely ignored when checking for Previous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a test to see what we get with Previous and Peek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TEST:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dim, Ver, Val&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 1, 100&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 1, 200&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 2, 120&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 2, 220&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A, 2, 300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;B, 2, 310&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR x = 1 to 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tmpFinal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Dim,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Val,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Ver,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Previous(Dim) = Dim, 0, 1) as TEST,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;Previous(Dim),&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;&amp;nbsp; Peek('Dim')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TEST&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Ver = '$(x)'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By Dim, Val;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEXT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Final:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident tmpFinal&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where TEST = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/137306_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:13:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183099#M383168</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-09-13T15:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: previous behaviour</title>
      <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183100#M383169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe Sunny is kind of right, we need to look at the &lt;EM&gt;input&lt;/EM&gt; table when talking about previous() and the input table is a copy of the RESIDENT TEST table ordered by Dim and Val, but without the WHERE clause already applied.&lt;/P&gt;&lt;P&gt;You can see this also when adding a Recno() field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tmpFinal:&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;Dim,&lt;/P&gt;&lt;P&gt;Val,&lt;/P&gt;&lt;P&gt;Ver,&lt;/P&gt;&lt;P&gt;if (previous(Dim)=Dim&amp;nbsp; ,0, 1) as TEST,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;recno() as TEST2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;//if (previous(Dim)=Dim and (Previous(Ver)=Ver) ,0, 1) as TEST&lt;/P&gt;&lt;P&gt;Resident TEST&lt;/P&gt;&lt;P&gt;where Ver='$(x)'&lt;/P&gt;&lt;P&gt;order by Dim, Val;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:16:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183100#M383169</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-09-13T15:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: previous behaviour</title>
      <link>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183101#M383170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Stefan and Sunny for your explanations.&lt;/P&gt;&lt;P&gt;I overtook a Project from a collegue who used the previous function&lt;/P&gt;&lt;P&gt;and as we were loosing data, I tried to understand why (with your explanations now I know).&lt;/P&gt;&lt;P&gt;Now I consider to use another function for our specific purpose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:27:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/previous-behaviour/m-p/1183101#M383170</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-13T15:27:40Z</dc:date>
    </item>
  </channel>
</rss>

