<?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 Calculation of Opening &amp;amp; Closing Stock in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423131#M95860</link>
    <description>&lt;P&gt;Dear&amp;nbsp; Experts&lt;/P&gt;
&lt;P&gt;I am trying to build a data set for stock opening balances with below Data. I have opening Balance (Bal_BF) of the products and the&amp;nbsp; Purchases and Sales of the respective months. I want to add Purchases to Bal_BF and deduct the Sales and arrive at Closing Balance (Bal_CF).&amp;nbsp; Bal_CF of a particular is the Bal_BF of next month and I want to fulfil this in data load script please. Below shown is my data set and expected out put please.Kindly help me.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Upali_Wijearatne_0-1708769595796.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160592i072129514961EE68/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Upali_Wijearatne_0-1708769595796.png" alt="Upali_Wijearatne_0-1708769595796.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Feb 2024 10:13:45 GMT</pubDate>
    <dc:creator>Upali_Wijearatne</dc:creator>
    <dc:date>2024-02-24T10:13:45Z</dc:date>
    <item>
      <title>Calculation of Opening &amp; Closing Stock</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423131#M95860</link>
      <description>&lt;P&gt;Dear&amp;nbsp; Experts&lt;/P&gt;
&lt;P&gt;I am trying to build a data set for stock opening balances with below Data. I have opening Balance (Bal_BF) of the products and the&amp;nbsp; Purchases and Sales of the respective months. I want to add Purchases to Bal_BF and deduct the Sales and arrive at Closing Balance (Bal_CF).&amp;nbsp; Bal_CF of a particular is the Bal_BF of next month and I want to fulfil this in data load script please. Below shown is my data set and expected out put please.Kindly help me.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Upali_Wijearatne_0-1708769595796.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160592i072129514961EE68/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Upali_Wijearatne_0-1708769595796.png" alt="Upali_Wijearatne_0-1708769595796.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 10:13:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423131#M95860</guid>
      <dc:creator>Upali_Wijearatne</dc:creator>
      <dc:date>2024-02-24T10:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Opening &amp; Closing Stock</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423153#M95867</link>
      <description>&lt;P&gt;Hi, you can use Peek() or Previous() to access previously loaded values, you can do a sorted load by PRD and Date and accumulae values from the previous row, like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OriginalData:
LOAD 
  Date, 
  PRD, 
  Bal_BF, 
  Purchase, 
  Sales
FROM [DataSource];

Balance:
LOAD
  Date, 
  PRD,
  If(PRD=Peek(PRD)
    ,Peek(Bal_CF)
    ,Bal_BF
  ) as Bal_BF,
  Purchase,
  Sales,
  If(PRD=Peek(PRD)
    ,RangeSum(Peek(Bal_CF),Purchase,-Sales)
    ,RangeSum(Bal_BF,Purchase,-Sales)
  ) as Bal_CF
Resident OriginalData
Order By PRD, Date;

DROP Table OriginalData;&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 24 Feb 2024 16:34:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423153#M95867</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2024-02-24T16:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Opening &amp; Closing Stock</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423159#M95868</link>
      <description>&lt;P&gt;Thanks Friend. It works fine&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 17:18:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-of-Opening-amp-Closing-Stock/m-p/2423159#M95868</guid>
      <dc:creator>Upali_Wijearatne</dc:creator>
      <dc:date>2024-02-24T17:18:35Z</dc:date>
    </item>
  </channel>
</rss>

