<?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 the previous value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131606#M91982</link>
    <description>&lt;P&gt;Hi, note that the accumulation is done like in the excel: mixing months and years.&lt;/P&gt;
&lt;P&gt;Apply 'Order by' on the FinalData table to accumulate by year, month, and any other fields you want to sort this accumulation.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 06:02:32 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2023-10-25T06:02:32Z</dc:date>
    <item>
      <title>Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2130576#M91921</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have just ran into an issue where i need to do cumulative sum keeping in mind the previous balance as well. I am able to do it on the front end but unable to replicate it in the load script. Below is a description of how to achieve it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So i have projects which come every day with a new unbilled amount and it might be in the same case the amount is than cleared as well, but there is always some left over balance which need to cumulated on every level of field such as Year, Month, Business Unit which is why i need it in the load script. in addition if someone selects a period such as 2022 Jan - it should have the last balance of 2021 - Dec or else the balance will be calculated wrongly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached the sample data&amp;nbsp; and the expression that i have used in the front end&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 07:08:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2130576#M91921</guid>
      <dc:creator>mnase11</dc:creator>
      <dc:date>2023-10-22T07:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2130746#M91924</link>
      <description>&lt;P&gt;Hi, to replicate Above() in script you can use Peek() or Previous().&lt;/P&gt;
&lt;P&gt;Full accumulation could be:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD
  New_Unbilled,
  Cleared,
  ... Other fields,
  Rangesum(New_Unbilled, Cleared, Peek(AccumulatedValue) as AccumulatedValue
From ...&lt;/LI-CODE&gt;
&lt;P&gt;You can add and order by and check with if() to accumulate by project or other fields, like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD
  New_Unbilled,
  Cleared,
  ... Other fields,
  If(Project=Peek(Project)
    ,Rangesum(New_Unbilled, -Cleared, Peek(AccumulatedValue) 
    ,Rangesum(New_Unbilled, -Cleared)
  ) as AccumulatedValue
Resident ...
Order By Project&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 22 Oct 2023 18:01:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2130746#M91924</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-10-22T18:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2130970#M91941</link>
      <description>&lt;P&gt;Dear Rube,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above is not working correctly, i might be doing something incorrect surely,&amp;nbsp; i have attached what i have done in the front end as an excel, i am trying to calculate ERP Balance field in the backend. Probably i was not able to able to clarify myself.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And this is the formula that i have used to calculate ERP Balance&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;rangesum(Above(total Sum(New_UnBilled-Cleared),0, RowNo(total)))&lt;/STRONG&gt;&lt;BR /&gt;"&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 10:12:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2130970#M91941</guid>
      <dc:creator>mnase11</dc:creator>
      <dc:date>2023-10-23T10:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131004#M91945</link>
      <description>&lt;P&gt;Hi, I already saw that Excel file, if something fails I will need to check the qlik sense app, paste the script where it is used. It will be better if you can add a sample app with non-real data to make some tests.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 11:59:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131004#M91945</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-10-23T11:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131010#M91946</link>
      <description>&lt;P&gt;it has an extra field added of what i am trying to achieve in the back end&lt;/P&gt;
&lt;P&gt;the balance field has the previous balance in mind and than adding the new unbilled &amp;amp; if there is cleared it will subtracted as well&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mnase11_0-1698062874795.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/118713i48B70801D727CF83/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mnase11_0-1698062874795.png" alt="mnase11_0-1698062874795.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 12:12:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131010#M91946</guid>
      <dc:creator>mnase11</dc:creator>
      <dc:date>2023-10-23T12:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131126#M91957</link>
      <description>&lt;P&gt;Hi, this script creates the ERP Balance column:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;tmpData:
LOAD
	[Project #],
	[Year],
	[Month],
	[ERP Cleared],
	[ERP New Unbilled]
 FROM [lib://DataFiles/Calculating Unbilled.xlsx]
(ooxml, embedded labels, table is Sheet1);

FinalData:
NoConcatenate
LOAD
	*,
    RowNo() as NumFila,
    Rangesum([ERP New Unbilled], -[ERP Cleared], Peek('ERP Balance')) as [ERP Balance]
Resident tmpData;

DROP Table tmpData;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 15:06:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131126#M91957</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-10-23T15:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131290#M91962</link>
      <description>&lt;P&gt;Hi it does create the Balance field but once we do the validation its completely wrong as for example the balance for the Jun-2019 should be&amp;nbsp;&lt;STRONG&gt;432,779,246&lt;/STRONG&gt;&amp;nbsp;but the above code is returning 89,331,234.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for convenience i have attached a sample qvf of the data and in the front end a basic table of what i am doing&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 07:45:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131290#M91962</guid>
      <dc:creator>mnase11</dc:creator>
      <dc:date>2023-10-24T07:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131538#M91980</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/251420"&gt;@mnase11&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to check before test.&lt;/P&gt;
&lt;P&gt;Is it the cumulative amount of the entire period per project# that you are trying to calculate?&lt;/P&gt;
&lt;P&gt;Or is it accumulated over the entire period regardless of Project#?&lt;/P&gt;
&lt;P&gt;please reply!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 00:25:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131538#M91980</guid>
      <dc:creator>MeehyeOh</dc:creator>
      <dc:date>2023-10-25T00:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum with the previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131606#M91982</link>
      <description>&lt;P&gt;Hi, note that the accumulation is done like in the excel: mixing months and years.&lt;/P&gt;
&lt;P&gt;Apply 'Order by' on the FinalData table to accumulate by year, month, and any other fields you want to sort this accumulation.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 06:02:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-with-the-previous-value/m-p/2131606#M91982</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-10-25T06:02:32Z</dc:date>
    </item>
  </channel>
</rss>

