<?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: Calculating rows on a table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1747130#M720867</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/126618"&gt;@mckay9999&lt;/a&gt;&amp;nbsp; try below. Assuming that your Date field is in proper Date format so that&amp;nbsp; order by statement can work as expected. If it is not in proper date format then try to convert it first.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Data:
LOAD Person,
     Date,
     if(len(trim(Buy))=0,0,Buy) as Buy,
     if(len(trim(Sell))=0,0,Sell) as Sell
FROM Table:

Final:
LOAD *,
     if(Person=Peek(Person), rangesum(peek(Buy_accum),Buy),Buy) as Buy_accum,
     if(Person=Peek(Person),rangesum(peek(Sell_Accum),Sell),Sell) as Sell_Accum
Resident Data
order by Person,Date,Buy;

DROP Table Data;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can then use below expression in chart&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=sum(Buy_accum)+sum(Sell_Accum)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-09-24 212829.png" style="width: 513px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/41214iA5C53790EE42870D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-09-24 212829.png" alt="Screenshot 2020-09-24 212829.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Sep 2020 10:46:51 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2020-09-25T10:46:51Z</dc:date>
    <item>
      <title>Calculating rows on a table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1746878#M720864</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I'm trying to write a formula where I'm calculating the values on various rows depending on the person that is showing in the table and by the date - so for example:&lt;BR /&gt;&lt;BR /&gt;Person&amp;nbsp; Buy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Sell&amp;nbsp; Date&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 24/09&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -5 &amp;nbsp; &amp;nbsp;&amp;nbsp; 24/09&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23/09&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22/09&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; -7 &amp;nbsp; &amp;nbsp; &amp;nbsp; 21/09&lt;BR /&gt;&lt;BR /&gt;so then I would have a 5th column called Total and within each row there will be a breakdown of accumulation of the buy/sell for each person. &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The table would look like below:&lt;BR /&gt;&lt;SPAN&gt;Person&amp;nbsp; Buy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Sell&amp;nbsp; Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Total&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 24/09 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 25 &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -5 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 24/09 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 15&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23/09 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22/09 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; -7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 21/09 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -7&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;I've tried a few things but it just seems to give me an overall value - does anyone know how I could achieve this?&lt;BR /&gt;Any help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:55:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1746878#M720864</guid>
      <dc:creator>mckay9999</dc:creator>
      <dc:date>2024-11-15T23:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rows on a table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1746957#M720865</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/126618"&gt;@mckay9999&lt;/a&gt;&amp;nbsp; do you want to do it in script or frond end?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 20:18:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1746957#M720865</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-09-24T20:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rows on a table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1747078#M720866</link>
      <description>&lt;P&gt;Hi Kush,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply - within the load script if that is possible please?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 08:32:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1747078#M720866</guid>
      <dc:creator>mckay9999</dc:creator>
      <dc:date>2020-09-25T08:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rows on a table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1747130#M720867</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/126618"&gt;@mckay9999&lt;/a&gt;&amp;nbsp; try below. Assuming that your Date field is in proper Date format so that&amp;nbsp; order by statement can work as expected. If it is not in proper date format then try to convert it first.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Data:
LOAD Person,
     Date,
     if(len(trim(Buy))=0,0,Buy) as Buy,
     if(len(trim(Sell))=0,0,Sell) as Sell
FROM Table:

Final:
LOAD *,
     if(Person=Peek(Person), rangesum(peek(Buy_accum),Buy),Buy) as Buy_accum,
     if(Person=Peek(Person),rangesum(peek(Sell_Accum),Sell),Sell) as Sell_Accum
Resident Data
order by Person,Date,Buy;

DROP Table Data;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can then use below expression in chart&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=sum(Buy_accum)+sum(Sell_Accum)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-09-24 212829.png" style="width: 513px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/41214iA5C53790EE42870D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-09-24 212829.png" alt="Screenshot 2020-09-24 212829.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 10:46:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-rows-on-a-table/m-p/1747130#M720867</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-09-25T10:46:51Z</dc:date>
    </item>
  </channel>
</rss>

