<?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: Expression to show Last n values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410179#M152577</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I double checked everything and can't see any errors.&amp;nbsp; Is there anything I can check to see why I'm getting null values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Apr 2013 17:20:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-04-01T17:20:33Z</dc:date>
    <item>
      <title>Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410174#M152572</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 have a column 'result' that can contain a 1 or 2 digit number or a single letter.&amp;nbsp; What I want is to create an expression, output, that shows the last 6 results separated by comma.&amp;nbsp; If result &amp;gt;= 10 then 0 should be used in the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table shows the desired results but despite playing about with various functions I've not been able to achieve this.&amp;nbsp; Any suggestions are most welcome &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;result&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;output&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;5,0,F,P,8,2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;0,F,P,8,2,6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;F,P,8,2,6,4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;P,8,2,6,4,1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;P&lt;/TD&gt;&lt;TD&gt;8,2,6,4,1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;2,6,4,1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;6,4,1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;4,1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 11:45:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410174#M152572</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-01T11:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410175#M152573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In load script try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(result &amp;gt;=10, 0, output) AS output&lt;/P&gt;&lt;P&gt;FROM DataSource;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 12:35:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410175#M152573</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-04-01T12:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410176#M152574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached qvw. I use two variables to build up this expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vConcat(1,2)) &amp;amp; $(vConcat(2,3)) &amp;amp; $(vConcat(3,4)) &amp;amp; $(vConcat(4,5)) &amp;amp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vConcat(5,6)) &amp;amp; if(len(trim($(vItem(6))))&amp;gt;0,$(vItem(6)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vItem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; below(if(num(result) &amp;gt;=10,0,result),$1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This checks if the value of result is a number &amp;gt;=10. The below function is used with parameter $1 to extract the value from x lines below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vConcat: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(len(trim($(vItem($1))))&amp;gt;0, if(len(trim($(vItem($2))))&amp;gt;0,$(vItem($1)) &amp;amp;',', $(vItem($1))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This checks for nulls so no extra comma's are added&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 13:56:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410176#M152574</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-04-01T13:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410177#M152575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&amp;nbsp; I use the following to load the datasource:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "database".dbo."table";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I incorporate the LOAD statement into this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 14:12:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410177#M152575</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-01T14:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410178#M152576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thankyou Gysbert, I am running Qlikview Personal Edition so cannot view your file but I like the idea of your solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created the two variables and the expression but unfortunately it is returning null values.&amp;nbsp; I'm double checking to make sure I've not made any errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 14:40:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410178#M152576</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-01T14:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410179#M152577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I double checked everything and can't see any errors.&amp;nbsp; Is there anything I can check to see why I'm getting null values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 17:20:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410179#M152577</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-01T17:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410180#M152578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm wondering if I'm seeing null values because of the use of num in the variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;below(if(&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;num&lt;/STRONG&gt;&lt;/SPAN&gt;(result) &amp;gt;=10,0,result),$1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;The result field can contain a letter as I stated in the original post.&amp;nbsp; I tried changing num to text but the output was still nulls so perhaps this is not the reason but thought I'd mention it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Matt&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 18:42:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410180#M152578</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-01T18:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410181#M152579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not the num. That's only to be able to compare the value with 10 only if it's a number. Is the name of your field really 'result'? Qlikview is case-sensitive so Result is not the same as result or RESULT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 08:40:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410181#M152579</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-04-02T08:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to show Last n values</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410182#M152580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The field name is actual_result.&amp;nbsp; I've amended this in the variable vItem and the case matches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 06:15:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-to-show-Last-n-values/m-p/410182#M152580</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-03T06:15:15Z</dc:date>
    </item>
  </channel>
</rss>

