<?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 Last 10 entries in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293640#M108939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try putting above expression in a Text box.&lt;/P&gt;&lt;P&gt;your dates needs to be recognized as such by QV, i.e. a num(date) e.g. as calculated Dimension should return numerical values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Sep 2011 15:30:15 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2011-09-27T15:30:15Z</dc:date>
    <item>
      <title>Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293637#M108936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to calculate the avarage of the last 10 entries (date_value). I have a Date, and an extra value attached to that date.&lt;/P&gt;&lt;P&gt;so 24-09-2011 with value "123".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;Thanks to an other topic, I thought I found a solution after modifications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(&lt;/P&gt;&lt;P&gt;aggr(&lt;/P&gt;&lt;P&gt;rank(total &lt;/P&gt;&lt;P&gt;aggr( (date_value),date_value)&lt;/P&gt;&lt;P&gt;,0,1) &lt;/P&gt;&lt;P&gt;,date_value)&lt;/P&gt;&lt;P&gt;&amp;lt;=10,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(&lt;/P&gt;&lt;P&gt;rank(total &lt;/P&gt;&lt;P&gt;aggr( (date_value),date_value)&lt;/P&gt;&lt;P&gt;,0,1) &lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;date_value))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I noticed this wasn't the solution. It &lt;STRONG&gt;shows &lt;/STRONG&gt;the last 10 entries in a table, but I'm planning on creating a Gauge which should display the avarage of these last 10 items. &lt;/P&gt;&lt;P&gt;Instead, if I place avg() in the above code, it shows the avarage of all values together. Not just the most recent 10 dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What expression should I use to get the last 10 entries (date), so I could calculate with just these 10 entries?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 13:05:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293637#M108936</guid>
      <dc:creator />
      <dc:date>2011-09-27T13:05:37Z</dc:date>
    </item>
    <item>
      <title>Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293638#M108937</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 think a &lt;/P&gt;&lt;P&gt;=avg(aggr(if(rank(date)&amp;lt;=10, date_value), date))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should give you the average of the values for the last 10 dates (date is a Date format, with a numerical representation, right?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 14:47:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293638#M108937</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-09-27T14:47:16Z</dc:date>
    </item>
    <item>
      <title>Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293639#M108938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmm how should I implement this?&lt;/P&gt;&lt;P&gt;Delete all the code I had and just put this code in place as calculated dimension?&lt;/P&gt;&lt;P&gt;Because I get no value then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I didn't explain it correctly,&lt;/P&gt;&lt;P&gt;but the dates all have a value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for example (5 dates for ease)&lt;/P&gt;&lt;P&gt;Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Value&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;27-09-2011 | 123&lt;/P&gt;&lt;P&gt;13-09-2011 | 119&lt;/P&gt;&lt;P&gt;24-08-2011 | 116&lt;/P&gt;&lt;P&gt;22-08-2011 | 122&lt;/P&gt;&lt;P&gt;01-08-2011 | 110&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The avarage should be the value of those (123+119+116+122+110) /5 = 118&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dates come from an Excel file where they have a Date Format.&lt;/P&gt;&lt;P&gt;Load DD as date_value&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 15:13:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293639#M108938</guid>
      <dc:creator />
      <dc:date>2011-09-27T15:13:06Z</dc:date>
    </item>
    <item>
      <title>Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293640#M108939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try putting above expression in a Text box.&lt;/P&gt;&lt;P&gt;your dates needs to be recognized as such by QV, i.e. a num(date) e.g. as calculated Dimension should return numerical values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 15:30:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293640#M108939</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-09-27T15:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293641#M108940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I really can't get it to work.&lt;/P&gt;&lt;P&gt;Just for information.&lt;/P&gt;&lt;P&gt;In my Original Excel sheets I have column A which has different Dates in it&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;27-09-2011 &lt;/P&gt;&lt;P&gt;13-09-2011 &lt;/P&gt;&lt;P&gt;24-08-2011 &lt;/P&gt;&lt;P&gt;22-08-2011 &lt;/P&gt;&lt;P&gt;01-08-2011 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;they are read in the following way:&lt;/P&gt;&lt;P&gt;Load DD as date_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In QV it shows the dates nice and correctly if I select =date_value.&lt;/P&gt;&lt;P&gt;It's shown the exact same way, so &lt;/P&gt;&lt;P&gt;27-09-2011 &lt;/P&gt;&lt;P&gt;13-09-2011 &lt;/P&gt;&lt;P&gt;24-08-2011 &lt;/P&gt;&lt;P&gt;22-08-2011 &lt;/P&gt;&lt;P&gt;01-08-2011 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use your code, should I leave "date" or should I&amp;nbsp; create someting else from it.&lt;/P&gt;&lt;P&gt;This because if I leave it date, the date_value doesn't get the redlike color.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I click new Chart and place this code in it via Calculated Dimension&lt;/P&gt;&lt;P&gt;I get an "// error in calculation dimension" error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As expression I then use =avg(Rv)&amp;nbsp; (which is that value of which I want the average, those 123, 119, 116 etc.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I guess I'm doing something wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried all different things with this piece of code, but till now, no success.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 06:32:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293641#M108940</guid>
      <dc:creator />
      <dc:date>2011-09-28T06:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293642#M108941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sorry, I assumed date_value is the field name for the value associated with that date, if it is your date field, and RV your value field, you need to change to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=avg(aggr(if(rank(date_value)&amp;lt;=10, Rv), date_value))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Put this expression in a textbox or use it as expression in your gauge chart (not as calculated dimension, why do you need a calculated dimension here?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attached a sample, I hope you are able to open the file and not working on a personal edition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your date_value needs to be recognizes as Date type, as said, and unfortunately it will display correctly even if not (because it might be interpreted as string then).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume the date format you have given above is also set in your script with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET DateFormat='DD-MM-YYYY';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, your date_value is almost certainly a Date type. To check, you could create e.g. a year field by using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;year(DD) as Year,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;From ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This only works correctly if DD (you need to use the original field name from excel here, date_value is yet unknown) is recognized as a Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 18:08:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293642#M108941</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-09-28T18:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Last 10 entries</title>
      <link>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293643#M108942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Stefan,&lt;/P&gt;&lt;P&gt;This was the solution.&lt;/P&gt;&lt;P&gt;I believe I tried this modification once, but I had an dimension added to it.&lt;/P&gt;&lt;P&gt;I deleted the dimension and indeed the correct value showed up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 06:30:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-10-entries/m-p/293643#M108942</guid>
      <dc:creator />
      <dc:date>2011-09-29T06:30:38Z</dc:date>
    </item>
  </channel>
</rss>

