<?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: Script Equivalent of &amp;quot;Above&amp;quot; Chart function? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537905#M686518</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the script you can use the Previous and Peek functions. See this document for an explanation of when to use one or the other: &lt;A href="https://community.qlik.com/docs/DOC-4073"&gt;Peek() vs Previous() – When to Use Each&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That said you will probably want to use another approach. See this document: &lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-4252" style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3778c7;"&gt;Calculating rolling n-period totals, averages or other aggregations&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Dec 2013 16:38:32 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-12-30T16:38:32Z</dc:date>
    <item>
      <title>Script Equivalent of "Above" Chart function?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537904#M686517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In my app dashboard, I have a Pivot Table showing Summary Stats for today and a line chart showing the trend of Qty plotted against a rolling average Qty over time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the chart, to calculate the rolling average value for the last 50 periods ([Date] dimension), I have a variable expression defined in the script as follows.&amp;nbsp; This is working perfectly because the Date dimension is shown on the graph, so I can use the Above function to retrieve the last 50 categories in the Date dimension and sum and then Avg the Qty for them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;RangeAvg(above(sum({$&amp;lt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;[Date]={"&amp;lt;=$(vDimDateFilter)"}&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;,WeekdayFlag={"Y"}&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;,[DimA]={"$(vDimAFilter)"}&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&amp;gt;} [Qty]),0,50))&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in my Pivot Table, the "Above" function wont work as I am not displaying the Date dimension in this table.&amp;nbsp; Here I just want to show the last value of this calculation - essentially the Avg value as at today for the last 50 Time periods. &lt;/P&gt;&lt;P&gt;Is there any way to define this with a script variable expression like the one above (excuse the pun!)?&amp;nbsp; &lt;/P&gt;&lt;P&gt;I know that I can resident load my raw data and use peek/previous to calculate and store the running total &amp;amp; avg values for the last 50 working days, but I want to avoid having to do that if possible as it will get a bit complex, with trying to determine working days etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Roz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 16:37:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537904#M686517</guid>
      <dc:creator />
      <dc:date>2013-12-30T16:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script Equivalent of "Above" Chart function?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537905#M686518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the script you can use the Previous and Peek functions. See this document for an explanation of when to use one or the other: &lt;A href="https://community.qlik.com/docs/DOC-4073"&gt;Peek() vs Previous() – When to Use Each&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That said you will probably want to use another approach. See this document: &lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-4252" style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3778c7;"&gt;Calculating rolling n-period totals, averages or other aggregations&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 16:38:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537905#M686518</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-12-30T16:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script Equivalent of "Above" Chart function?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537906#M686519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks but as I mentioned in my original post, I know that I could use peek/previous to calculate and store the values in memory but what I'm asking for here is an alternative to that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Roz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 16:42:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537906#M686519</guid>
      <dc:creator />
      <dc:date>2013-12-30T16:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script Equivalent of "Above" Chart function?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537907#M686520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm, can you elaborate a bit more what's wrong with storing the values in memory?&lt;/P&gt;&lt;P&gt;Or with using the peek/previous functions in the script?&lt;/P&gt;&lt;P&gt;Or with all the different suggested approaches following Gysbert's second link (have you even read his blog post within the two minutes)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 17:09:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537907#M686520</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-12-30T17:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Script Equivalent of "Above" Chart function?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537908#M686521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;It's not that there is anything wrong with using the peek/previous to load &amp;amp; store every possible rolling total/average value that will be needed in the app - I'm just asking if anyone knows of a simpler alternative to this on the scripting side like the "Above" function in charts because this is such a neat and simple way to get the same result, that does not require loading of any extra data into memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't read Gysbert's second link before my reply, because it was not there in his original post - I assume he edited it following my comment that I was already aware of the peek/previous functions.&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, 30 Dec 2013 17:26:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537908#M686521</guid>
      <dc:creator />
      <dc:date>2013-12-30T17:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script Equivalent of "Above" Chart function?</title>
      <link>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537909#M686522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the second link Gysbert - I had read it before but appreciate you taking the time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 17:27:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-Equivalent-of-quot-Above-quot-Chart-function/m-p/537909#M686522</guid>
      <dc:creator />
      <dc:date>2013-12-30T17:27:38Z</dc:date>
    </item>
  </channel>
</rss>

