<?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: Previus value in table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388648#M1167274</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the loadscript you can check for null values, and apply an if statement. In pseudo-code: if value isNull (in my code: len()&amp;lt;1) THEN get previousvalue, else, the current value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;code&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13471371029633089" jivemacro_uid="_13471371029633089"&gt;&lt;P&gt;source:&lt;/P&gt;&lt;P&gt;load *&lt;/P&gt;&lt;P&gt; inline [&lt;/P&gt;&lt;P&gt;Date,Code,Level&lt;/P&gt;&lt;P&gt;10/11/2011,k10,50&lt;/P&gt;&lt;P&gt;10/11/2011,k20,150&lt;/P&gt;&lt;P&gt;11/11/2011,k10,60&lt;/P&gt;&lt;P&gt;11/11/2011,k20,&lt;/P&gt;&lt;P&gt;12/11/2011,k10,80&lt;/P&gt;&lt;P&gt;12/11/2011,k20,200 &lt;/P&gt;&lt;P&gt;] &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;destination:&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;Date,Code,Level,&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,previous(Level),Level) as previousColumn&lt;/P&gt;&lt;P&gt;Resident source&lt;/P&gt;&lt;P&gt;order by Code,Date;//note: the orderby (and sequence of orderby is important for which previous() value is picked...&lt;/P&gt;&lt;P&gt;drop table source;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also attached for the example in a qvw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Sep 2012 20:46:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-09-08T20:46:04Z</dc:date>
    <item>
      <title>Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388647#M1167273</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;I got a table with three columns (Date, Code, Level).&lt;/P&gt;&lt;P&gt;Sometimes I getting null values in level column, when in level column is null I need replace to last value for specific code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example below:&lt;/P&gt;&lt;P&gt;Record 11/11/2011, K20 - is null the I need to get last value (sort by date) for K20 which is 150.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21539" class="jive-image" alt="table.jpg" src="https://community.qlik.com/legacyfs/online/21539_table.jpg" /&gt;&lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 20:28:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388647#M1167273</guid>
      <dc:creator />
      <dc:date>2012-09-08T20:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388648#M1167274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the loadscript you can check for null values, and apply an if statement. In pseudo-code: if value isNull (in my code: len()&amp;lt;1) THEN get previousvalue, else, the current value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;code&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13471371029633089" jivemacro_uid="_13471371029633089"&gt;&lt;P&gt;source:&lt;/P&gt;&lt;P&gt;load *&lt;/P&gt;&lt;P&gt; inline [&lt;/P&gt;&lt;P&gt;Date,Code,Level&lt;/P&gt;&lt;P&gt;10/11/2011,k10,50&lt;/P&gt;&lt;P&gt;10/11/2011,k20,150&lt;/P&gt;&lt;P&gt;11/11/2011,k10,60&lt;/P&gt;&lt;P&gt;11/11/2011,k20,&lt;/P&gt;&lt;P&gt;12/11/2011,k10,80&lt;/P&gt;&lt;P&gt;12/11/2011,k20,200 &lt;/P&gt;&lt;P&gt;] &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;destination:&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;Date,Code,Level,&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,previous(Level),Level) as previousColumn&lt;/P&gt;&lt;P&gt;Resident source&lt;/P&gt;&lt;P&gt;order by Code,Date;//note: the orderby (and sequence of orderby is important for which previous() value is picked...&lt;/P&gt;&lt;P&gt;drop table source;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also attached for the example in a qvw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 20:46:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388648#M1167274</guid>
      <dc:creator />
      <dc:date>2012-09-08T20:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388649#M1167275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roberto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer - is working fine but when you I type in k30 code first time and the the level will be null, previus() function will return previus value of level but I will expect null because there was no last value for k30.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21540" alt="123.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/21540_123.jpg" /&gt;&lt;BR /&gt;there is any way to work around the problem ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 21:07:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388649#M1167275</guid>
      <dc:creator />
      <dc:date>2012-09-08T21:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388650#M1167276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure you can workaround this problem. In the if-statement, you can check whether the previous value of the field Code equals the current value of Code. If not, then return NULL, else return the value you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The updated code will be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;load &lt;BR /&gt;&amp;nbsp; Date, &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;&amp;nbsp; Code,&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;&amp;nbsp; Level,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if(len(Level)&amp;lt;1,&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here the additional check...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(previous(Code)=Code,&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;&amp;nbsp;&amp;nbsp; previous(Level),&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //return NULL if previous code does NOT have the same value as the current CODE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),Level) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as previousColumn&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;Resident source&lt;BR /&gt;order by Code,Date;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2012 22:07:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388650#M1167276</guid>
      <dc:creator />
      <dc:date>2012-09-08T22:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388651#M1167277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I found the problem with multiples rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;source:&lt;/P&gt;&lt;P&gt;load *&lt;/P&gt;&lt;P&gt; inline [&lt;/P&gt;&lt;P&gt;Date,Code,Level&lt;/P&gt;&lt;P&gt;11/11/2011,k10,&lt;/P&gt;&lt;P&gt;15/07/2011,k10,&lt;/P&gt;&lt;P&gt;20/02/2011,k10,&lt;/P&gt;&lt;P&gt;25/08/2011,k10,&lt;/P&gt;&lt;P&gt;09/09/2011,k10,&lt;/P&gt;&lt;P&gt;01/12/2011,k10,&lt;/P&gt;&lt;P&gt;06/04/2011,k10,&lt;/P&gt;&lt;P&gt;04/05/2011,k10,&lt;/P&gt;&lt;P&gt;09/10/2011,k10,20&lt;/P&gt;&lt;P&gt;10/01/2011,k10,10&lt;/P&gt;&lt;P&gt;] &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;destination:&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;Date,Code,Level,&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,previous(Level),Level) as previousColumn,&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,if(previous(Code)=Code,previous(Level),NULL()),Level) as previousColumn1&lt;/P&gt;&lt;P&gt;Resident source&lt;/P&gt;&lt;P&gt;order by Code,Date asc;&lt;/P&gt;&lt;P&gt;drop table source;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21576" class="jive-image" alt="12.jpg" src="https://community.qlik.com/legacyfs/online/21576_12.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like the script just "copy" previous record for first empty column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is any way to work around ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 08:43:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388651#M1167277</guid>
      <dc:creator />
      <dc:date>2012-09-10T08:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388652#M1167278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use peek() instead of previous().&lt;/P&gt;&lt;P&gt;previous() works with source so it gives you blanks except the first row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget, with peek() you should use field names from &lt;SPAN style="text-decoration: underline;"&gt;resulting table&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 08:49:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388652#M1167278</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-10T08:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388653#M1167279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whiteline, could you complete the example? I tried using peek() with this statement&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,peek(Level,-1,'destination'),Level) as previousPEEK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But no difference...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 09:09:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388653#M1167279</guid>
      <dc:creator />
      <dc:date>2012-09-10T09:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388654#M1167280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use corresponding field names:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,peek(&lt;STRONG&gt;previousColumn&lt;/STRONG&gt;),Level) as &lt;STRONG&gt;previousColumn&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;if(len(Level)&amp;lt;1,if(previous(Code)=Code,peek(&lt;STRONG&gt;previousColumn1&lt;/STRONG&gt;),NULL()),Level) as &lt;STRONG&gt;previousColumn1&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 09:29:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388654#M1167280</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-10T09:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388655#M1167281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah... I didn't realize that peek could refer to its own fieldname. Good to know!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@krzysiekk: is your problem solved with this info?&lt;/P&gt;&lt;P&gt;If not, let us know what your current outcome is, and your desired outcome. I think with this additional info the problem can be solved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 09:36:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388655#M1167281</guid>
      <dc:creator />
      <dc:date>2012-09-10T09:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388656#M1167282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes all sorted - thanks for help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 09:54:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388656#M1167282</guid>
      <dc:creator />
      <dc:date>2012-09-10T09:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Previus value in table</title>
      <link>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388657#M1167283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please mark the answer as correct to close the thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 11:12:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Previus-value-in-table/m-p/388657#M1167283</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-10T11:12:20Z</dc:date>
    </item>
  </channel>
</rss>

