<?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: Cumulative sum with negative values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943032#M955702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great ! Thank you so much &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just found a solution with FABS() function and an other intermediate table...&lt;/P&gt;&lt;P&gt;But your solution is far better &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Nov 2015 16:58:28 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-11-19T16:58:28Z</dc:date>
    <item>
      <title>Cumulative sum with negative values</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943027#M955697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do a cumulative sum, but when there is a negative value, I want it to be subtracted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what i have done :&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;RangeSum(EarnBurn_Journée,Peek(EarnBurn_Journée_Cumul))&lt;/TD&gt;&lt;TD&gt;as EarnBurn_Journée_Cumul&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="106095" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/106095_Capture.PNG" style="height: 148px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;You see that when it encounters "-600", the cumul is made on all dates and then it continues from "1162".&lt;/P&gt;&lt;P&gt;What I need is (see right table) :&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;1162&lt;/P&gt;&lt;P&gt;562&lt;/P&gt;&lt;P&gt;635&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how i can handle it ?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 15:44:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943027#M955697</guid>
      <dc:creator />
      <dc:date>2015-11-19T15:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with negative values</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943028#M955698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it seems to be another issue, the expression you are using seems to be right. Can you share the complete script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 16:01:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943028#M955698</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-19T16:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with negative values</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943029#M955699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AGGR_SoldePoints_temp:&lt;/P&gt;&lt;P&gt;LOAD PassId_an&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,AccountTransactionValueValidityStartDate_DATE as AGGR_Account_Date&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,AccountTransactionValueValidityStartDate_AnnéeMois as AGGR_Account_AnnéeMois&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,SUM(AccountTransactionValue) as EarnBurn_Journée&lt;/P&gt;&lt;P&gt;RESIDENT F_AccountTransaction&lt;/P&gt;&lt;P&gt;WHERE RuleCode&amp;lt;&amp;gt;'VISITEMAGASIN'&lt;/P&gt;&lt;P&gt;GROUP BY PassId_an,AccountTransactionValueValidityStartDate_AnnéeMois, AccountTransactionValueValidityStartDate_DATE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AGGR_Solde:&lt;/P&gt;&lt;P&gt;LOAD PassId_an&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,AGGR_Account_AnnéeMois&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,AGGR_Account_Date&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,RangeSum(EarnBurn_Journée,Peek(EarnBurn_Journée_Cumul)) as EarnBurn_Journée_Cumul&lt;/P&gt;&lt;P&gt;RESIDENT AGGR_SoldePoints_temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE AGGR_SoldePoints_temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 16:06:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943029#M955699</guid>
      <dc:creator />
      <dc:date>2015-11-19T16:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with negative values</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943030#M955700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Same situation with a very simple example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; F1, F2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a, 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a, 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b, 50&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b, 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b, -20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c, 30&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d, 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d, 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e, -10&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;LOAD F1&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,F2&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,RangeSum(F2,Peek(F2_Cumul)) as F2_Cumul&lt;/P&gt;&lt;P&gt;RESIDENT Input;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Input;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture2.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/106096_Capture2.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 16:34:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943030#M955700</guid>
      <dc:creator />
      <dc:date>2015-11-19T16:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with negative values</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943031#M955701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it is an order issue. The numbers are getting Summed properly, you just need to add a order by statement in your resident load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at this script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Input:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RowNo() as UK;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; F1, F2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a, 10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b, 50&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b, 6&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b, -20&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c, 30&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d, 6&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d, 8&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e, -10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD F1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; ,F2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; , UK&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; ,RangeSum(F2,Peek(F2_Cumul)) as F2_Cumul&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RESIDENT Input&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By UK;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP TABLE Input;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/106090_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 16:41:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943031#M955701</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-19T16:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with negative values</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943032#M955702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great ! Thank you so much &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just found a solution with FABS() function and an other intermediate table...&lt;/P&gt;&lt;P&gt;But your solution is far better &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 16:58:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-with-negative-values/m-p/943032#M955702</guid>
      <dc:creator />
      <dc:date>2015-11-19T16:58:28Z</dc:date>
    </item>
  </channel>
</rss>

