<?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: Calculation Stock Start and STock End in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1939136#M77409</link>
    <description>&lt;P&gt;you cant just use min(date variable) - it retiurns a number and not a date.&amp;nbsp; you need to use:&lt;BR /&gt;&lt;BR /&gt;date(min(date field)), if the default format is diff, you should add the desired format:&lt;BR /&gt;date(min(date field), 'format here')&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2022 18:33:58 GMT</pubDate>
    <dc:creator>edwin</dc:creator>
    <dc:date>2022-06-02T18:33:58Z</dc:date>
    <item>
      <title>Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935380#M77062</link>
      <description>&lt;P&gt;Hello , we have Database related to ERP which include all transaction of supply chain,i explain my problem by the table bellow&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 300pt;" border="0" width="400" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="80" height="19" style="height: 14.5pt; width: 60pt;"&gt;Date&lt;/TD&gt;
&lt;TD width="80" style="width: 60pt;"&gt;Start_Stock&lt;/TD&gt;
&lt;TD width="80" style="width: 60pt;"&gt;Income&lt;/TD&gt;
&lt;TD width="80" style="width: 60pt;"&gt;Outcome&lt;/TD&gt;
&lt;TD width="80" style="width: 60pt;"&gt;End_stock&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl63" style="height: 14.5pt;"&gt;01/01/2022&lt;/TD&gt;
&lt;TD align="right" class="xl64"&gt;0&lt;/TD&gt;
&lt;TD align="right"&gt;100&lt;/TD&gt;
&lt;TD align="right"&gt;50&lt;/TD&gt;
&lt;TD align="right" class="xl64"&gt;50&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl63" style="height: 14.5pt;"&gt;31/01/2022&lt;/TD&gt;
&lt;TD align="right" class="xl64"&gt;50&lt;/TD&gt;
&lt;TD align="right"&gt;200&lt;/TD&gt;
&lt;TD align="right"&gt;100&lt;/TD&gt;
&lt;TD align="right" class="xl64"&gt;150&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in 01/01/2022 we 0 as start of stock there are income of 100 and utcome of 50 so end of stock is 50 in qlikview i success to got income and outcome&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to creat a variable where we put values of Start Stock and put also End stock&lt;/P&gt;
&lt;P&gt;Start stock must have the value of the previous End Stock i hope that it is clear can u help me please t developp my dahsboard in qlikview&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 11:43:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935380#M77062</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-25T11:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935622#M77090</link>
      <description>&lt;P&gt;are you saying the table shown is the output table you want?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and that you calculate Income, Outcome and End_Stock?&amp;nbsp; how about Start?&lt;BR /&gt;can you post sample data?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is a sample if start needs to be computed from 0:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edwin_0-1653491014227.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80325iB8204BF749642C32/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edwin_0-1653491014227.png" alt="edwin_0-1653491014227.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dimension is Date, start (Column 1):&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=if(isnull(above(Column(4))),0,above(Column(4)))&lt;/P&gt;
&lt;P&gt;column 4 (End):&lt;/P&gt;
&lt;P&gt;=column(1)+Column(2)-Column(3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 15:04:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935622#M77090</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-25T15:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935668#M77093</link>
      <description>&lt;P&gt;Hi that is right the shown table must look like the table on qlikview&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can calculate income and outcome but for star of stock we need to declare a variable so after that we could calculate end of stock and when the date increase the start of stock must equal to end of stock of previous d?&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 16:18:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935668#M77093</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-25T16:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935670#M77094</link>
      <description>&lt;P&gt;I will try your formula and going back to you soon&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 16:20:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935670#M77094</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-25T16:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935680#M77096</link>
      <description>&lt;P&gt;just replace the 0 in the start expression:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;=if(isnull(above(Column(4))),$(vStartVariable),above(Column(4)))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 16:43:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935680#M77096</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-25T16:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935755#M77101</link>
      <description>&lt;P&gt;Hi Edwin thanks for help regarding the variable "vstartvariable" does I must declared it before or I run the expression directly?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 19:59:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935755#M77101</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-25T19:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935796#M77108</link>
      <description>&lt;P&gt;Hi again Edwin i tried you formula but it dosen't work on my real table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="theboss123_0-1653518145439.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80350i974334F55D170D2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="theboss123_0-1653518145439.png" alt="theboss123_0-1653518145439.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column(1)==if(isnull(above(Column(4))),$(vStartVariable),above(Column(4)))&lt;/P&gt;
&lt;P&gt;Column(4)=Column(1)+Entréé-Sortie&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 22:38:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1935796#M77108</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-25T22:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936439#M77172</link>
      <description>&lt;P&gt;Hello is there any solution for our case ?&lt;/P&gt;
&lt;P&gt;To make the idea a bit clear,the start stock of each article must be 0,because before integration of data to the ERP X3 the stock was 0 for each ITEM,so regarding the transaction of income and outcome the quantity change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The start Date is 24/01/2015 .&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 11:29:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936439#M77172</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-27T11:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936507#M77185</link>
      <description>&lt;P&gt;you pls post sample data?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 12:14:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936507#M77185</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-27T12:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936524#M77188</link>
      <description>&lt;P&gt;Please Find enclosed the sample Data. i work avec QLIKVIEW DESKTOP V12.20&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 12:36:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936524#M77188</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-27T12:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936568#M77194</link>
      <description>&lt;P&gt;you are apparently using QlikView but your post is in Qlik Sense.&amp;nbsp; i am able to pull in your data but i cant see any visualization.&amp;nbsp; so pls tell me what is your expression for Entree and Sortie?&amp;nbsp; ill try to help as i have time on my hands&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 13:33:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936568#M77194</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-27T13:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936590#M77198</link>
      <description>&lt;P&gt;i just realized you changed the problem, adding a 2nd dimension changes the solution.&lt;/P&gt;
&lt;P&gt;as the calculation for Entree and Sortie is irrelevant, i just threw in a random calculation:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edwin_0-1653659866685.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80490i5C6C515A52693C85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edwin_0-1653659866685.png" alt="edwin_0-1653659866685.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;as i am using column numbers, the order is important.&amp;nbsp; also, having the 2nd dimension, chnaged the determination of the prior record.&amp;nbsp; to simplify the solution i opted to use Rowno() to determine the 1st record.&amp;nbsp; you can try it out on your own, add the two dimenstions and add Rowno() as a measure, you will see it starts with 1 everytime the first dimension changes.&amp;nbsp; so if you test for rowno()=1 it is the first occurrence of dimension 1.&lt;/P&gt;
&lt;P&gt;so now the start measure is&lt;/P&gt;
&lt;P&gt;=if(rowno()=1,0,above( Column(4)))&amp;nbsp; -&amp;gt; if this is the first record for dimension1, = 0, else get the 4th measure.&lt;/P&gt;
&lt;P&gt;the 4th measure is still the same:&lt;/P&gt;
&lt;P&gt;=Col1 + Col2 - Col3&lt;/P&gt;
&lt;P&gt;im sure there could be a smarter solution for this but i hope this helps&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:02:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936590#M77198</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-27T14:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936591#M77199</link>
      <description>&lt;P&gt;i just noticed Sortie is already negative, so your 4th measure should be Col1 + Col2 + Col3&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:05:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936591#M77199</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-27T14:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936871#M77225</link>
      <description>&lt;P&gt;First I would like to thank you for your effort to help me&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To calculate entree I got combinaision of all trades section of income like receipt of an order ,inventory and more the same thing for the outcome sortie&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will try your below suggestion&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 May 2022 22:55:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936871#M77225</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-28T22:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936874#M77226</link>
      <description>&lt;P&gt;Hello ,&lt;/P&gt;
&lt;P&gt;Your solution solv 50% of the issue,but when i select another range of that it take the first line COl1 as 0 which make the quantity wrong please find below a comparaison between the screenshoot of stock on the ERP X3 and on QLIKVIEW,Your expression is Correct but when i select a range of date the col1 in the first line is 0 however it had a quantity before .&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="theboss123_0-1653780808951.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80545iD7A2A97AEF3BD375/image-size/medium?v=v2&amp;amp;px=400" role="button" title="theboss123_0-1653780808951.png" alt="theboss123_0-1653780808951.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="theboss123_1-1653780837201.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80546i98B69F1C1F7D45E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="theboss123_1-1653780837201.png" alt="theboss123_1-1653780837201.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 May 2022 23:45:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936874#M77226</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-28T23:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936966#M77229</link>
      <description>&lt;P&gt;you did say "&lt;SPAN&gt;To make the idea a bit clear,the start stock of each article must be 0&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;what i think you meant was without any selection the stock starts at 0 which makes sense to me.&amp;nbsp; i was wondering why you wanted it to always start from 0.&amp;nbsp; but it was you who asked for it that way.&amp;nbsp; let me take a look tomorrow unless someone else gives you an answer&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 01:31:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1936966#M77229</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-30T01:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1937195#M77244</link>
      <description>&lt;P&gt;Thanks Edwin for your reaction,you are close to find a solution just try to do your best please&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The start stock globaly must have 0&lt;/P&gt;
&lt;P&gt;the start stock of a selection of date range must give me the stock quanity of the before column4&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 11:38:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1937195#M77244</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-30T11:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1937955#M77313</link>
      <description>&lt;P&gt;quickest solution i can think of is this (someone else im sure can come up with a better one)&lt;/P&gt;
&lt;P&gt;1. create a new date field that is independent of your date field.&amp;nbsp; you will allow the user to select this new field.&lt;/P&gt;
&lt;P&gt;2. create 2 new variables: vMinDate and vMaxDate which represent the lower and upper bounds of the selected dates&lt;/P&gt;
&lt;P&gt;3. in your table create this date dimension (i didnt explore much and maybe this can be simpler):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;=if(&lt;BR /&gt;IPTDAT_0&amp;gt;=date('$(vMinDate)') &lt;BR /&gt;and IPTDAT_0&amp;lt;=date('$(vMaxDate)')&lt;BR /&gt;and (aggr( sum( {&amp;lt;Transaction={'Entrée diverse'}&amp;gt;}[Qantité]),IPTDAT_0, Dim3)&amp;gt;0 or &lt;BR /&gt;aggr( sum( {&amp;lt;Transaction={ 'Sortie diverse'}&amp;gt;}[Qantité]), IPTDAT_0, Dim3)&amp;lt;0&lt;BR /&gt;)&lt;BR /&gt;, &lt;BR /&gt;IPTDAT_0&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;4. your income:&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;IPTDAT_0={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"},Transaction={'Entrée diverse'}&amp;gt;}[Qantité])&lt;/P&gt;
&lt;P&gt;5. your sortie:&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;IPTDAT_0={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"},Transaction={'Sortie diverse'}&amp;gt;}[Qantité])&lt;/P&gt;
&lt;P&gt;6. start:&lt;/P&gt;
&lt;P&gt;rangesum(above(Sum({&amp;lt;IPTDAT_0={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"},Transaction={'Entrée diverse'}&amp;gt;}[Qantité]),&lt;BR /&gt;1,rowno()))+&lt;BR /&gt;rangesum(above(Sum({&amp;lt;IPTDAT_0={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"},Transaction={'Sortie diverse'}&amp;gt;}[Qantité]),&lt;BR /&gt;1,rowno()))+&lt;BR /&gt;+aggr( nodistinct Sum( {&amp;lt;IPTDAT_0={"&amp;lt;$(vMinDate)"},Transaction={'Entrée diverse', 'Sortie diverse'}&amp;gt;}[Qantité]), Dim3)&lt;/P&gt;
&lt;P&gt;7. your end :&lt;/P&gt;
&lt;P&gt;rangesum(above(Sum({&amp;lt;IPTDAT_0={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"},Transaction={'Entrée diverse'}&amp;gt;}[Qantité]),&lt;BR /&gt;0,rowno()))+&lt;BR /&gt;rangesum(above(Sum({&amp;lt;IPTDAT_0={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"},Transaction={'Sortie diverse'}&amp;gt;}[Qantité]),&lt;BR /&gt;0,rowno()))+&lt;BR /&gt;+aggr( nodistinct Sum( {&amp;lt;IPTDAT_0={"&amp;lt;$(vMinDate)"},Transaction={'Entrée diverse', 'Sortie diverse'}&amp;gt;}[Qantité]), Dim3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the solution is to use range sum and above.&amp;nbsp; notice that in the above for start, the range starts one row above the current row.&amp;nbsp; for end, above starts at current row.&amp;nbsp; and the aggr expression just sums everything before the selected date range.&amp;nbsp; i suspect the aggr will come back as null when there are no rows before the selected dates so maybe just add an if isnull and replace with 0 if null else use the aggr&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 18:38:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1937955#M77313</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-31T18:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1937956#M77314</link>
      <description>&lt;P&gt;the reason my solution requires a new date field is that if you use the same field as the selected field, you will have problems associating the current date with prior dates unless you create some relationship which you may not have an appetite for.&lt;/P&gt;
&lt;P&gt;heres the above function:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/ChartFunctions/InterRecordFunctions/above.htm#:~:text=Above()%20evaluates%20an%20expression,being%20the%20row%20directly%20above" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/ChartFunctions/InterRecordFunctions/above.htm#:~:text=Above()%20evaluates%20an%20expression,being%20the%20row%20directly%20above&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 18:40:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1937956#M77314</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-05-31T18:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Stock Start and STock End</title>
      <link>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1938000#M77315</link>
      <description>&lt;P&gt;I would like to thank you for your effort,i try to follow your steps, how can i creat a date fields&amp;nbsp; i have already IPTDAT_0 fields&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 22:49:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculation-Stock-Start-and-STock-End/m-p/1938000#M77315</guid>
      <dc:creator>theboss-123</dc:creator>
      <dc:date>2022-05-31T22:49:51Z</dc:date>
    </item>
  </channel>
</rss>

