<?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: Rolling sum pivot/straight table problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259742#M857484</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; font-size: 13px;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Thanks &lt;A href="https://community.qlik.com/qlik-users/171708"&gt;stalwar1&lt;/A&gt; I have used this - &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If(Sum(amount) &amp;gt; 0, RangeSum(Above(Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12))), but the problem is when I sort the rpt_prd_date_id to descending it will change the rolling sum since we are using above logic here. I would like to know if there is any way to calculate the rolling sum based on the date values for the past 12 months instead of using above() function. Any suggestions?Thanks!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jan 2017 03:25:08 GMT</pubDate>
    <dc:creator>phoenix</dc:creator>
    <dc:date>2017-01-31T03:25:08Z</dc:date>
    <item>
      <title>Rolling sum pivot/straight table problem</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259740#M857482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the below pivot table for calculating sum of Amount for each month_end and also calculate rolling 12 months sum of amount.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;formula used:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sum(amount)&lt;/P&gt;&lt;P&gt;sum(aggr(rangesum(above(total sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount),0,12)),RPT_PRD_DATE_ID))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Formula for rolling 12 months seems to work perfectly except for the first few months where sum(amount) = 0; for these months it is giving wrong rolling sum.&lt;/P&gt;&lt;P&gt;Ex: 20080630 for this month sum(amount) = 0 and since there are no prior month end I expect to see rolling sum to be '0' too. But for some reason for this month is adding up the amounts for 20161231 - 20160131 (which are the last 12 month end dates in my data).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need help on fixing this issue.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/151329_pastedImage_1.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259740#M857482</guid>
      <dc:creator>phoenix</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling sum pivot/straight table problem</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259741#M857483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;If(Sum(amount) &amp;gt; 0, Sum(Aggr(RangeSum(Above(TOTAL Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12)),RPT_PRD_DATE_ID)))&lt;/STRONG&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; font-size: 13px;"&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; font-size: 13px;"&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;Sum(Aggr(RangeSum(Above(TOTAL Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount),0,12)),RPT_PRD_DATE_ID)) * Avg(1)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; 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-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Having said that, do you really need Sum(Aggr()) Here? May be this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; 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-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If(Sum(amount) &amp;gt; 0, RangeSum(Above(TOTAL Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12)))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;RangeSum(Above(TOTAL Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12)) * Avg(1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, why do you need a TOTAL? You only have one dimension.... I don't think it adds any value. So, try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If(Sum(amount) &amp;gt; 0, RangeSum(Above(Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12)))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;or&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;RangeSum(Above(Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12)) * Avg(1)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 02:37:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259741#M857483</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-01-31T02:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling sum pivot/straight table problem</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259742#M857484</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; font-size: 13px;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Thanks &lt;A href="https://community.qlik.com/qlik-users/171708"&gt;stalwar1&lt;/A&gt; I have used this - &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If(Sum(amount) &amp;gt; 0, RangeSum(Above(Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12))), but the problem is when I sort the rpt_prd_date_id to descending it will change the rolling sum since we are using above logic here. I would like to know if there is any way to calculate the rolling sum based on the date values for the past 12 months instead of using above() function. Any suggestions?Thanks!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 03:25:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259742#M857484</guid>
      <dc:creator>phoenix</dc:creator>
      <dc:date>2017-01-31T03:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling sum pivot/straight table problem</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259743#M857485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use Below() instead of Above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;If(Sum(amount) &amp;gt; 0, RangeSum(&lt;SPAN style="color: #ff0000;"&gt;Below&lt;/SPAN&gt;(Sum({&amp;lt;RPT_PRD_DATE_ID=&amp;gt;} amount), 0, 12)))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 03:30:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259743#M857485</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-01-31T03:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling sum pivot/straight table problem</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259744#M857486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 03:41:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259744#M857486</guid>
      <dc:creator>phoenix</dc:creator>
      <dc:date>2017-01-31T03:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling sum pivot/straight table problem</title>
      <link>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259745#M857487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please close the thread if you got what you wanted.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-14806"&gt;Qlik Community Tip: Marking Replies as Correct or Helpful&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 10:19:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rolling-sum-pivot-straight-table-problem/m-p/1259745#M857487</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-01-31T10:19:43Z</dc:date>
    </item>
  </channel>
</rss>

