<?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: RangeAvg with Above/Below getting strange results in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542092#M481371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends on where your expectation comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I look into my HELP file for above() function, it says:&lt;/P&gt;&lt;P&gt;"Specifying an &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; greater than 1 lets you move the evaluation of &lt;SPAN class="Italic"&gt;expression&lt;/SPAN&gt; to rows further up the current row. &lt;STRONG&gt;A negative &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; number will actually make the &lt;SPAN class="Bold"&gt;above&lt;/SPAN&gt; function equivalent to a &lt;SPAN class="Bold"&gt;below&lt;/SPAN&gt; function with the corresponding positive &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; number.&lt;/STRONG&gt; Specifying an &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; of 0 will evaluate the &lt;SPAN class="Italic"&gt;expression&lt;/SPAN&gt; on the current row. Recursive calls will return NULL. &lt;/P&gt;&lt;P&gt;By specifying a third parameter &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; greater than 1, the function will return not one but a range of &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; values, one for each of &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; table rows counting upwards from the original cell. In this form, the function can be used as an argument to any of the special &lt;A _jive_internal="true" class="MCXref_0" href="https://community.qlik.com/message/Chart_Range_functions.htm"&gt;&lt;EM&gt;Chart Range Functions&lt;/EM&gt;&lt;/A&gt;. "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=rangeavg(above(sum(totalcost),-3,7))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should be equivalent to &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=rangeavg(below(sum(totalcost),3,7))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I think (without rechecking your results) that's what you get.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Oct 2013 14:20:47 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-10-11T14:20:47Z</dc:date>
    <item>
      <title>RangeAvg with Above/Below getting strange results</title>
      <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542088#M481367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;&lt;EM&gt;UPDATE per discussion below&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;:&amp;nbsp; &lt;/EM&gt;&lt;SPAN style="color: #333333;"&gt;&lt;EM&gt;The functions are behaving as advertised for Above() and Below().&amp;nbsp; However the examples used in the HELP docs for the various Range functions are incorrect when using negative numbers with Above().&amp;nbsp; Apparently I'm not the first person to encounter this issue.&amp;nbsp; The Help Docs for Range functions need to be corrected.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to calculate a 7-day moving average for a specified Cost.&amp;nbsp; In this case, I actually want to take the average of the current day and three previous days and three subsequent days.&amp;nbsp; Reading up on RangeAvg, this seemed rather trivial, but I am not achieving the expected results.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;So to calculate the moving average, I would just need to do either of the following:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: blue;"&gt;rangeavg&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: blue;"&gt;below&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: maroon;"&gt;totalcost&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;),-3,7)) ------- This should take the RangeAvg of the totalcost starting at 3 above and include through 3 below the current row.&amp;nbsp; What I actually see is the average of the 7 rows below starting 9 rows above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;The other option is to use the above function:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: blue;"&gt;rangeavg&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: blue;"&gt;above&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: maroon;"&gt;totalcost&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;),-3,7)) &lt;/SPAN&gt;------- This should take the RangeAvg of the totalcost starting at 3 below and include through 3 above the current row. What I actually see is the average of&amp;nbsp; the 7 rows above starting 9 rows below.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;I tried a couple other combinations of numbers to get the rows right, but nothing seemed to work.&amp;nbsp; I'm pretty sure I'm missing something fundamental here.&amp;nbsp; Please help &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;H3 style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Data Set:&lt;/SPAN&gt;&lt;/H3&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;INLINE&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;[&lt;BR /&gt; Date, totalcost, Expected&lt;BR /&gt; 01/01/2013, $30.87, &lt;BR /&gt; 01/02/2013, $78.66, &lt;BR /&gt; 01/03/2013, $71.44, &lt;BR /&gt; 01/04/2013, $42.00, $53.40&lt;BR /&gt; 01/05/2013, $37.44, $55.33&lt;BR /&gt; 01/06/2013, $56.24, $49.06&lt;BR /&gt; 01/07/2013, $57.12, $41.99&lt;BR /&gt; 01/08/2013, $44.38, $38.12&lt;BR /&gt; 01/09/2013, $34.80, $36.22&lt;BR /&gt; 01/10/2013, $21.92, $32.25&lt;BR /&gt; 01/11/2013, $14.95, $29.37&lt;BR /&gt; 01/12/2013, $24.12, $26.84&lt;BR /&gt; 01/13/2013, $28.44, $28.24&lt;BR /&gt; 01/14/2013, $37.00, $32.63&lt;BR /&gt; 01/15/2013, $26.64, $39.73&lt;BR /&gt; 01/16/2013, $44.59, $41.01&lt;BR /&gt; 01/17/2013, $52.70, $43.68&lt;BR /&gt; 01/18/2013, $64.60, $48.48&lt;BR /&gt; 01/19/2013, $33.12, $59.52&lt;BR /&gt; 01/20/2013, $47.09, $62.00&lt;BR /&gt; 01/21/2013, $70.62, $58.36&lt;BR /&gt; 01/22/2013, $103.95, $56.89&lt;BR /&gt; 01/23/2013, $61.94, $60.85&lt;BR /&gt; 01/24/2013, $27.18, $63.61&lt;BR /&gt; 01/25/2013, $54.34, $61.85&lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;H3 style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Output:&lt;/SPAN&gt;&lt;/H3&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="657.1818182468414" style="width: 497.18181824684143px; height: 650.1818182468414px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="98"&gt;Date&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="98"&gt;totalcost&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="98"&gt;Expected average&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="261"&gt;&lt;P&gt;=rangeavg(below(&lt;/P&gt;&lt;P&gt;sum(totalcost),-3,7))&lt;/P&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="243"&gt;&lt;P&gt;=rangeavg(above(&lt;/P&gt;&lt;P&gt;sum(totalcost),-3,7))&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/01/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$30.87&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$41.99&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/02/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$78.66&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$38.12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/03/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$71.44&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$36.22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/04/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$42.00&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$53.40&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$30.87&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$32.25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/05/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$37.44&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$55.33&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$54.77&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$29.37&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/06/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$56.24&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$49.06&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$60.32&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$26.84&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/07/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$57.12&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$41.99&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$55.74&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$28.24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/08/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$44.38&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$38.12&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$52.08&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$32.63&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/09/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$34.80&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$36.22&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$52.78&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$39.73&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/10/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$21.92&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$32.25&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$53.40&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$41.01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/11/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$14.95&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$29.37&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$55.33&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$43.68&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/12/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$24.12&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$26.84&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$49.06&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$48.48&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/13/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$28.44&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$28.24&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$41.99&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$59.52&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/14/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$37.00&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$32.63&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$38.12&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$62.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="17" style="border-top: none;"&gt;&lt;STRONG&gt;01/15/2013&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$26.64&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$39.73&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$36.22&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$58.36&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/16/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$44.59&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$41.01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$32.25&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$56.89&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/17/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$52.70&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$43.68&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$29.37&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$60.85&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/18/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$64.60&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$48.48&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;$26.84&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$63.61&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/19/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$33.12&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$59.52&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$28.24&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$61.85&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/20/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$47.09&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$62.00&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$32.63&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$47.82&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/21/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$70.62&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$58.36&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$39.73&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$40.76&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/22/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$103.95&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$56.89&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$41.01&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$54.34&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/23/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$61.94&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$60.85&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$43.68&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/24/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$27.18&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$63.61&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$48.48&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;01/25/2013&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$54.34&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$61.85&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;$59.52&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 17:26:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542088#M481367</guid>
      <dc:creator />
      <dc:date>2013-10-10T17:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg with Above/Below getting strange results</title>
      <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542089#M481368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RangeAvg(above(sum(totalcost),1,3),below(sum(totalcost),1,3),sum(totalcost))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: &lt;A _jive_internal="true" href="https://community.qlik.com/thread/83757"&gt;a similar discussion&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 17:42:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542089#M481368</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-10T17:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg with Above/Below getting strange results</title>
      <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542090#M481369</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;See this example:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 20:02:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542090#M481369</guid>
      <dc:creator>felipe_dutra</dc:creator>
      <dc:date>2013-10-10T20:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg with Above/Below getting strange results</title>
      <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542091#M481370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.qlik.com/qlik-users/15823"&gt;swuehl&lt;/A&gt; and &lt;A href="https://community.qlik.com/qlik-users/76717"&gt;Felipe Dutra&lt;/A&gt;!&amp;nbsp; Both answers are very helpful and provide a workaround for the solution.&amp;nbsp; I am also curious, however, why the function does not behave as expected in my example.&amp;nbsp; Is it a QlikView bug?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 14:13:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542091#M481370</guid>
      <dc:creator />
      <dc:date>2013-10-11T14:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg with Above/Below getting strange results</title>
      <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542092#M481371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends on where your expectation comes from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I look into my HELP file for above() function, it says:&lt;/P&gt;&lt;P&gt;"Specifying an &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; greater than 1 lets you move the evaluation of &lt;SPAN class="Italic"&gt;expression&lt;/SPAN&gt; to rows further up the current row. &lt;STRONG&gt;A negative &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; number will actually make the &lt;SPAN class="Bold"&gt;above&lt;/SPAN&gt; function equivalent to a &lt;SPAN class="Bold"&gt;below&lt;/SPAN&gt; function with the corresponding positive &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; number.&lt;/STRONG&gt; Specifying an &lt;SPAN class="Italic"&gt;offset&lt;/SPAN&gt; of 0 will evaluate the &lt;SPAN class="Italic"&gt;expression&lt;/SPAN&gt; on the current row. Recursive calls will return NULL. &lt;/P&gt;&lt;P&gt;By specifying a third parameter &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; greater than 1, the function will return not one but a range of &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; values, one for each of &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; table rows counting upwards from the original cell. In this form, the function can be used as an argument to any of the special &lt;A _jive_internal="true" class="MCXref_0" href="https://community.qlik.com/message/Chart_Range_functions.htm"&gt;&lt;EM&gt;Chart Range Functions&lt;/EM&gt;&lt;/A&gt;. "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=rangeavg(above(sum(totalcost),-3,7))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should be equivalent to &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=rangeavg(below(sum(totalcost),3,7))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I think (without rechecking your results) that's what you get.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 14:20:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542092#M481371</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-11T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: RangeAvg with Above/Below getting strange results</title>
      <link>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542093#M481372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yup, I read the docs on Above(), Below(), and RangeAve().&amp;nbsp; It appears that the formula is working properly per the description of Above() and Below(), but the &lt;SPAN style="text-decoration: underline;"&gt;examples&lt;/SPAN&gt; in the docs are incorrect for Range____().&amp;nbsp; For example, from the HELP docs:&lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-LeftBold" style="margin-right: auto;"&gt;&lt;TBODY&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;rangecount (above(sum(x),-1,3))&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;returns the number of values within the three results of the &lt;SPAN class="Bold"&gt;sum(x)&lt;/SPAN&gt; function evaluated on the row below the current row, the current row and the row above the current row.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE cellspacing="0" class="TableStyle-LeftBold" style="margin-right: auto;"&gt;&lt;TBODY&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;rangemin (above(sum(x),-1,3))&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;returns the lowest of the three results of the &lt;SPAN class="Bold"&gt;sum(x)&lt;/SPAN&gt; function evaluated on the row below the current row, the current row and the row above the current row.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The descriptions are incorrect, and I just verified that they do not do what they describe.&amp;nbsp; So, I guess if I just focused on the description of Above() and Below(), and ignored the examples for Range____(), I would not have not had this issue.&amp;nbsp; Lesson learned &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/silly.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 18:17:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RangeAvg-with-Above-Below-getting-strange-results/m-p/542093#M481372</guid>
      <dc:creator />
      <dc:date>2013-10-11T18:17:23Z</dc:date>
    </item>
  </channel>
</rss>

