<?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>article Calculating rolling n-period totals, averages or other aggregations in Member Articles</title>
    <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/ta-p/1483033</link>
    <description>&lt;P style="margin-bottom: 0.14in;" lang="en"&gt;&lt;SPAN&gt;&lt;SPAN&gt;A question that gets asked regularly is how to calculate a rolling measure over a period of N-months (or weeks or days). For example a 12-month rolling total or a 4-week rolling average. There are several ways to do this. But these approaches have some limitations that need to be kept in mind. I'll try to explain these approaches and some of their limitations.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Accumulation&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;RangeXXX functions&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Set analysis&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;AsOf tables&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;First let's load some sample data. The SalesData table below will contain sales amount values for twelve consecutive months.&lt;/SPAN&gt;&lt;/SPAN&gt;&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;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;11,9&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;12,7&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This is a very simple table with little data, but this enough for demonstration purposes.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Once this data is loaded it's possible to create a straight table chart object to display the amount per month and a running total. As expected Month is used as dimension. The expression &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;sum(Amount)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; will display the amount per month. Now let's add an expression to calculate a running total over three month periods. &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;This can be done in two ways. The first uses the Accumulation option for expressions. The same expression &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;sum(Amount)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; is used, but now the Accumulation option is set to 3 Steps Back:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;IMG class="jive-image jive-image-thumbnail" src="https://community.qlik.com/legacyfs/online/40487_rolling_2.png" border="0" alt="rolling_2.png" width="620" /&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The second option uses the rangesum function. That expression looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;     rangesum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;above&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;),0,3)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;This sums the Amount value on current row and on the previous two rows. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;The resulting straight table looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt; &lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40480_rolling_1.png" border="0" alt="rolling_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;" lang="en"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;This looks good. The rolling 3 months amount is calculated correctly. But what happens if a selection of months is made? &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40488_rolling_3.png" border="0" alt="rolling_3.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The rolling 3 month amount for month 4 is now 3 instead of 14. This is because month 1,2 and 3 are no longer included in the calculation for the rolling 3 month total.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The accumulation option has another issue. It only works when only one dimension is used in the straight table. The rangesum expression can be modified so it can calculate across dimension borders, but the accumulation option can't. The modified rangesum expression adds the total keyword to the above() function:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;     rangesum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;above&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;total s&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;um&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;),0,3))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;This goes some way to doing what we want, but the issue of displaying the wrong rolling 3 month amount for month 4 isn't solved yet. Contrary to what I first thought there is a solution for this, as Henric pointed out to me in the comments below. By combining the rangesum with the aggr function it's possible to calculate the correct rolling 3 month amounts for each month. The expression needed for that looks like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;     sum(aggr(rangesum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;above&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;total s&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;um&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;Month=&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;),0,3)),Month))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Read &lt;A href="https://community.qlik.com/people/etk" target="_blank"&gt;Elif&lt;/A&gt;'s blog post&lt;/SPAN&gt;&lt;SPAN&gt; &lt;A style="background-color: #ffffff; color: #007fc0; font-family: Arial;" href="https://community.qlik.com/blogs/qlikviewdesignblog/2012/10/12/accumulative-sums" target="_blank"&gt;Accumulative Sums&lt;/A&gt; for a more complete explanation.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;How about set analysis expressions?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This expression should calculate the sum of amount for the three month period:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;     sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'&amp;gt;=$(=only(Month)-2)&amp;lt;=$(=only(Month))'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;But notice the only() function. This requires that only one month value is selected. After selecting month 4 the result looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40490_rolling_4.png" border="0" alt="rolling_4.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This shows the selected month, but also the two previous months. And the values are not accumulated. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;Ok, but what about the max function instead of only?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;     sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'&amp;gt;=$(=max(Month)-2)&amp;lt;=$(=max(Month))'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;That gives a different result, but still not what we're looking for:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/41815_rolling_7.png" border="0" alt="rolling_7.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now only the last three months are shown and again the values are not accumulated. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;The 'problem' is that the set is calculated once for the entire chart, not per row. This means that it's not possible here to use Month both as a dimension and in the set modifier in the expression.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;There's still an option left to discuss: AsOf tables.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;The AsOf table links a period with all the periods in the rolling period. In this example months are used, but it can be applied to any type of period like hours, days or weeks. &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;For the three month periods needed for a rolling 3 month total this means a month should be linked to itself, the previous month and the month before the previous month. The only exceptions are the first month, which is itself the rolling 3 month period, and the second month that together with the first month is its rolling 3 month period. There are no months before the first month so the first two months cannot run over 3 months.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The AsOf table needed for the rolling 3 month calculations looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40491_rolling_5.png" border="0" alt="rolling_5.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This table can be created like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;AsOfMonth:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;SPAN&gt;&lt;SPAN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&gt;join&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;What this does is create three records for every month using the while statement. But that also creates three records for month 1 and 2. This would create a month 0 and a month -1. The right join is used to remove those incorrect month values.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now that the AsOfMonth table is created the Month_AsOf field can be used instead of the Month field in the straight table. The expression for the straigh table is simply &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;sum(Amount).&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40492_rolling_6.png" border="0" alt="rolling_6.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The straight table now shows the correct rolling 3 month total for month 4.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This can be expanded a little so not only the rolling 3 month can be shown, but also the amount for the month itself.  To achieve this the AsOf table is modified by adding a field to label the type of period. And records are added to the table so each Month_AsOf value is linked to the matching Month value:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;AsOfMonth:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; 'Current' &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month_AsOf&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/S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PAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;while&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;IterNo&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;() &amp;lt;= 3;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;right&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;join&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData; &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;There are now two types of periods available: Current and Rolling 3. Additional period types can be added for example for Rolling 6, Rolling 12 month and Year-to-Date periods. You can find examples of these types in the attached &lt;A href="https://community.qlik.com/servlet/JiveServlet/download/4252-9-63245/AsOf Table Examples.qvw" target="_blank"&gt;AsOf Table Examples.qvw&lt;/A&gt; document.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The period type can be used in the chart expressions to calculate the amount for the wanted period:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Current amount: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'Current'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Rolling 3 month amount: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'Rolling 3'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;Concluding, there are two solutions that do what we want:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;1. The rangesum-aggr combination&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;2. The AsOf table&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;The first has the advantage that no changes to the data model are needed. It's also possible to dynamically change the period to aggregate over by using a variable instead of a hardcoded number of periods. A disadvantage is that that it's a somewhat complicated expression that also comes with a performance cost. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;The AsOf needs changes in the data model to create the AsOf table and fill it with the necessary records. The advantage is that it likely performs better on large data sets. It's also quite versatile since you can add several sets of records to meet different scenario's. The expressions you end up with in the charts are also less complicated. That said, it will likely take you some time to fully understand the AsOf table concept and realize all the places where you can put it to good use.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;In the end you'll have to decide for yourself which solution is appropriate in your situation. With regards to the performance of one or the other solution, you will simply have to test to discover if the performance is acceptable. But of course such testing is already part of your development process, right? &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I'd like to thank &lt;SPAN&gt;&lt;A class="jiveTT-hover-user jive-username-link" style="background-color: #ffffff; font-size: 12px; color: #007fc0; font-weight: bold; font-family: Arial; text-align: center;" href="https://community.qlik.com/people/JohnW" target="_blank"&gt;John Witherspoon&lt;/A&gt;&lt;/SPAN&gt; for introducing me to the &lt;A href="https://community.qlik.com/message/101275#101275" target="_blank"&gt;AsOf tables concept&lt;/A&gt; and &lt;A href="https://community.qlik.com/people/hic" target="_blank"&gt;Henric&lt;/A&gt; for pointing out the solution using the rangesum function in combination with the aggr function.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Nov 2022 14:45:07 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2022-11-30T14:45:07Z</dc:date>
    <item>
      <title>Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/ta-p/1483033</link>
      <description>&lt;P style="margin-bottom: 0.14in;" lang="en"&gt;&lt;SPAN&gt;&lt;SPAN&gt;A question that gets asked regularly is how to calculate a rolling measure over a period of N-months (or weeks or days). For example a 12-month rolling total or a 4-week rolling average. There are several ways to do this. But these approaches have some limitations that need to be kept in mind. I'll try to explain these approaches and some of their limitations.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Accumulation&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;RangeXXX functions&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Set analysis&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;AsOf tables&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;First let's load some sample data. The SalesData table below will contain sales amount values for twelve consecutive months.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;SalesData:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;inline&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month, Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;1,6&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;2,4&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;3,7&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;4,3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;5,4&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;6,9&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;7,5&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;8,7&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;9,8&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;10,6&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;11,9&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;12,7&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This is a very simple table with little data, but this enough for demonstration purposes.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Once this data is loaded it's possible to create a straight table chart object to display the amount per month and a running total. As expected Month is used as dimension. The expression &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;sum(Amount)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; will display the amount per month. Now let's add an expression to calculate a running total over three month periods. &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;This can be done in two ways. The first uses the Accumulation option for expressions. The same expression &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;sum(Amount)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; is used, but now the Accumulation option is set to 3 Steps Back:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;IMG class="jive-image jive-image-thumbnail" src="https://community.qlik.com/legacyfs/online/40487_rolling_2.png" border="0" alt="rolling_2.png" width="620" /&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The second option uses the rangesum function. That expression looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;     rangesum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;above&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;),0,3)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;This sums the Amount value on current row and on the previous two rows. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;The resulting straight table looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt; &lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40480_rolling_1.png" border="0" alt="rolling_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;" lang="en"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;This looks good. The rolling 3 months amount is calculated correctly. But what happens if a selection of months is made? &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40488_rolling_3.png" border="0" alt="rolling_3.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The rolling 3 month amount for month 4 is now 3 instead of 14. This is because month 1,2 and 3 are no longer included in the calculation for the rolling 3 month total.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The accumulation option has another issue. It only works when only one dimension is used in the straight table. The rangesum expression can be modified so it can calculate across dimension borders, but the accumulation option can't. The modified rangesum expression adds the total keyword to the above() function:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;     rangesum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;above&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;total s&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;um&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;),0,3))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;This goes some way to doing what we want, but the issue of displaying the wrong rolling 3 month amount for month 4 isn't solved yet. Contrary to what I first thought there is a solution for this, as Henric pointed out to me in the comments below. By combining the rangesum with the aggr function it's possible to calculate the correct rolling 3 month amounts for each month. The expression needed for that looks like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;     sum(aggr(rangesum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;above&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;total s&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;um&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;Month=&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;),0,3)),Month))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Read &lt;A href="https://community.qlik.com/people/etk" target="_blank"&gt;Elif&lt;/A&gt;'s blog post&lt;/SPAN&gt;&lt;SPAN&gt; &lt;A style="background-color: #ffffff; color: #007fc0; font-family: Arial;" href="https://community.qlik.com/blogs/qlikviewdesignblog/2012/10/12/accumulative-sums" target="_blank"&gt;Accumulative Sums&lt;/A&gt; for a more complete explanation.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;How about set analysis expressions?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This expression should calculate the sum of amount for the three month period:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;     sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'&amp;gt;=$(=only(Month)-2)&amp;lt;=$(=only(Month))'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;But notice the only() function. This requires that only one month value is selected. After selecting month 4 the result looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40490_rolling_4.png" border="0" alt="rolling_4.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This shows the selected month, but also the two previous months. And the values are not accumulated. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;Ok, but what about the max function instead of only?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;     sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'&amp;gt;=$(=max(Month)-2)&amp;lt;=$(=max(Month))'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;That gives a different result, but still not what we're looking for:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/41815_rolling_7.png" border="0" alt="rolling_7.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now only the last three months are shown and again the values are not accumulated. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;The 'problem' is that the set is calculated once for the entire chart, not per row. This means that it's not possible here to use Month both as a dimension and in the set modifier in the expression.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;There's still an option left to discuss: AsOf tables.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;The AsOf table links a period with all the periods in the rolling period. In this example months are used, but it can be applied to any type of period like hours, days or weeks. &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;For the three month periods needed for a rolling 3 month total this means a month should be linked to itself, the previous month and the month before the previous month. The only exceptions are the first month, which is itself the rolling 3 month period, and the second month that together with the first month is its rolling 3 month period. There are no months before the first month so the first two months cannot run over 3 months.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The AsOf table needed for the rolling 3 month calculations looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40491_rolling_5.png" border="0" alt="rolling_5.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This table can be created like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;AsOfMonth:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&g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;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;right&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;join&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;What this does is create three records for every month using the while statement. But that also creates three records for month 1 and 2. This would create a month 0 and a month -1. The right join is used to remove those incorrect month values.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now that the AsOfMonth table is created the Month_AsOf field can be used instead of the Month field in the straight table. The expression for the straigh table is simply &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;sum(Amount).&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;IMG class="jive-image" src="https://community.qlik.com/legacyfs/online/40492_rolling_6.png" border="0" alt="rolling_6.png" /&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The straight table now shows the correct rolling 3 month total for month 4.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;This can be expanded a little so not only the rolling 3 month can be shown, but also the amount for the month itself.  To achieve this the AsOf table is modified by adding a field to label the type of period. And records are added to the table so each Month_AsOf value is linked to the matching Month value:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;AsOfMonth:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; 'Current' &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month_AsOf&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Resident&lt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t;&lt;SPAN&gt;&lt;SPAN&gt;() &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;while&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;IterNo&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;() &amp;lt;= 3;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;right&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;join&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;SPAN&gt;Resident&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; SalesData; &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;There are now two types of periods available: Current and Rolling 3. Additional period types can be added for example for Rolling 6, Rolling 12 month and Year-to-Date periods. You can find examples of these types in the attached &lt;A href="https://community.qlik.com/servlet/JiveServlet/download/4252-9-63245/AsOf Table Examples.qvw" target="_blank"&gt;AsOf Table Examples.qvw&lt;/A&gt; document.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 0.14in;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;The period type can be used in the chart expressions to calculate the amount for the wanted period:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Current amount: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'Current'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Rolling 3 month amount: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;({&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Type&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;={'Rolling 3'}&amp;gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Amount&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;Concluding, there are two solutions that do what we want:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;1. The rangesum-aggr combination&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;2. The AsOf table&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;The first has the advantage that no changes to the data model are needed. It's also possible to dynamically change the period to aggregate over by using a variable instead of a hardcoded number of periods. A disadvantage is that that it's a somewhat complicated expression that also comes with a performance cost. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;The AsOf needs changes in the data model to create the AsOf table and fill it with the necessary records. The advantage is that it likely performs better on large data sets. It's also quite versatile since you can add several sets of records to meet different scenario's. The expressions you end up with in the charts are also less complicated. That said, it will likely take you some time to fully understand the AsOf table concept and realize all the places where you can put it to good use.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P lang="en"&gt;&lt;SPAN&gt;In the end you'll have to decide for yourself which solution is appropriate in your situation. With regards to the performance of one or the other solution, you will simply have to test to discover if the performance is acceptable. But of course such testing is already part of your development process, right? &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P lang="en"&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I'd like to thank &lt;SPAN&gt;&lt;A class="jiveTT-hover-user jive-username-link" style="background-color: #ffffff; font-size: 12px; color: #007fc0; font-weight: bold; font-family: Arial; text-align: center;" href="https://community.qlik.com/people/JohnW" target="_blank"&gt;John Witherspoon&lt;/A&gt;&lt;/SPAN&gt; for introducing me to the &lt;A href="https://community.qlik.com/message/101275#101275" target="_blank"&gt;AsOf tables concept&lt;/A&gt; and &lt;A href="https://community.qlik.com/people/hic" target="_blank"&gt;Henric&lt;/A&gt; for pointing out the solution using the rangesum function in combination with the aggr function.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 14:45:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/ta-p/1483033</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2022-11-30T14:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483034#M846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good post! It covers a number of different methods well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But there is an additional way to solve this problem - and that is to combine the RangeSum(Above()) with the Aggr() function, e.g.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;rangesum&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;above&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;(Sales),0,12) ),&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: maroon;"&gt;Month&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then each row (or bar or slice) will be a sum over different "rows" defined in the Aggr() function. See more on &lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2012/10/12/accumulative-sums"&gt;Accumulative Sums&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 08:03:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483034#M846</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-06-10T08:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483035#M847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And whoa, I totally missed that one. A belated aha-erlebnis. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Thanks for mentioning that solution. I remember seeing Elif's post but it probably went right over my head back in October.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 18:09:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483035#M847</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-06-10T18:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483036#M848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One question on the AsOf table - if you were do calculations that did not involve rolling amounts, would you have problems with data being duplicated to create the additional rows?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 14:02:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483036#M848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-11T14:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483037#M849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The typical usage would be that you have a field from the AsOf table as dimension and Sum(Amount) as expression. Then the Amount will be summed in the transaction table - where this field resides.&lt;/P&gt;&lt;P&gt;Which means that the same dollar will be counted in several different months, &lt;EM&gt;&lt;STRONG&gt;but the totals will still be correct&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 15:45:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483037#M849</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-07-11T15:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483038#M850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gyssbert/Henric,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help in providing some examples in the above QVW, in including some other dimensions like Product? Just wanted to know the logic of other dimensions being used with the above mentioned logic.&lt;/P&gt;&lt;P&gt;Please share example in QVW.&lt;/P&gt;&lt;P&gt;Thanks!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Aug 2013 18:00:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483038#M850</guid>
      <dc:creator>dmohanty</dc:creator>
      <dc:date>2013-08-26T18:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483039#M851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A _jive_internal="true" href="https://community.qlik.com/servlet/JiveServlet/download/4252-9-63245/AsOf Table Examples.qvw" style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3778c7; text-decoration: underline; background-color: #fdfdfd;"&gt;AsOf Table Examples&lt;/A&gt; document has more dimensions. As long as the AsOf table is linked to the fact table on the date (or in the example on Period1 month field) your fact table can have any number of dimensions, either directly as fields in the fact table or in tables linked to the fact table by key fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Aug 2013 18:41:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483039#M851</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-08-26T18:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483040#M852</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;Many Thanks..This QVW and this post helped a lot in achieving my targets. Learnt a new logic as well.&lt;/P&gt;&lt;P&gt;Looking forward for more concepts and supports. Thanks again. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Regards!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 03:18:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483040#M852</guid>
      <dc:creator>dmohanty</dc:creator>
      <dc:date>2013-08-28T03:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483041#M853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent post. I finally found, thanks to this post, what I was looking for : how to get a &lt;STRONG&gt;simple&lt;/STRONG&gt; moving total, year to date or a comparison versus previous year.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2013 16:11:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483041#M853</guid>
      <dc:creator />
      <dc:date>2013-09-16T16:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483042#M854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent post &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Gysbert&lt;/SPAN&gt;! Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 16:27:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483042#M854</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2013-09-23T16:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483043#M855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very Useful post with step by step move on application...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 09:52:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483043#M855</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2013-10-09T09:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483044#M856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an alternative solution to the problem showing the rolling 3 months, I'd like to suggest combining the set expression with the sum(aggr(rangesum(...))):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;lt;Month={'&amp;gt;=$(=max(Month)-2)&amp;lt;=$(=max(Month))'}&amp;gt;} &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(rangesum(above(total sum({&amp;lt;Month=&amp;gt;}Amount),0,3)),Month)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And to everyone that tries to use this approach, I would like to emphasize what Elif noted at the end of the blog post: take care that your load order of Month is in chronological order, e.g. by creating manually the Month field first in the script or using a sorted load when first reading in the Month field. The aggr() function sorts the Month dimension values by load order, thus the above() function used in the aggr() expression will regard this order, not the outer chart dimension order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2013 18:20:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483044#M856</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-24T18:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483045#M857</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;last year total sales &lt;/P&gt;&lt;P&gt;add as a new column&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be done added ?&lt;IMG alt="exp5.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48842_exp5.png" style="width: 620px; height: 375px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Nov 2013 15:09:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483045#M857</guid>
      <dc:creator>selcukcadir</dc:creator>
      <dc:date>2013-11-11T15:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483046#M858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent ! Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 08:30:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483046#M858</guid>
      <dc:creator />
      <dc:date>2013-11-14T08:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483047#M859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. Very useful post!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Nov 2013 20:18:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483047#M859</guid>
      <dc:creator>marthacano01</dc:creator>
      <dc:date>2013-11-18T20:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483048#M860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Excellent post for every QV Developer...!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Thanks alot Mr. &lt;A href="https://community.qlik.com/people/gwassenaar"&gt;gwassenaar&lt;/A&gt;&lt;SPAN style="color: #8b8b8b; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt; &lt;/SPAN&gt;.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 05:26:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483048#M860</guid>
      <dc:creator />
      <dc:date>2013-11-19T05:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483049#M861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome, we can see the different of all methods and got the best way! Thanks so much for your contribution!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 08:35:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483049#M861</guid>
      <dc:creator />
      <dc:date>2013-12-02T08:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483050#M862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't want to limit yourself to maintaining the load order for the time column here is another approach to aggregation. &lt;A href="https://community.qlik.com/thread/23746"&gt;Year On Year / Month On Month&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This would probably work for &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="6949" data-externalid="" data-presence="null" data-userid="66397" data-username="selcukcadir" href="https://community.qlik.com/people/selcukcadir"&gt;selçuk çadır.&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 13:23:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483050#M862</guid>
      <dc:creator />
      <dc:date>2013-12-04T13:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483051#M863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent post. The post solves smartly the problem of calculating YTD and moving averages.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 11:56:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483051#M863</guid>
      <dc:creator>joseluis_garcia</dc:creator>
      <dc:date>2014-01-22T11:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling n-period totals, averages or other aggregations</title>
      <link>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483052#M864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Gysbert,&lt;/P&gt;&lt;P&gt;I like your second approach with the "&lt;SPAN style="font-family: verdana, geneva; color: #000000;"&gt;AsOf"-&lt;/SPAN&gt;table, that defines your periodes in the data model.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Herbert&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Jan 2014 13:57:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Calculating-rolling-n-period-totals-averages-or-other/tac-p/1483052#M864</guid>
      <dc:creator>herbert_beck</dc:creator>
      <dc:date>2014-01-26T13:57:45Z</dc:date>
    </item>
  </channel>
</rss>

