<?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 Cumulative sum 'grouped by' in load script ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429616#M160139</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 would like to load a table with cumulative stock value per date, material, plant. (a kind of running-total group by or like an Oracle 'over partition' function)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have only movement (goods issue and goods receipt qty) by plant, material, date...in SAP source, and i have the starting qty for the same dimensions...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so the cumulative value per material, plant, date... would be the stock start value + sum of all mvts (GR-GI) up to the current processed date in the load script....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This cumulative value represents the value of the stock for this date, this plant, this material... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a graph, it would be something like :rangesum&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Stock_Variance&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 0, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;rowno&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If I could load it in a table with a script, It would be easier to retrieve the stock value for any period selected...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Is there any way to use the rangesum function in a script with 'group by' features ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Many thanks for your support,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Chris&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Sep 2012 14:14:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-09-21T14:14:20Z</dc:date>
    <item>
      <title>Cumulative sum 'grouped by' in load script ?</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429616#M160139</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 would like to load a table with cumulative stock value per date, material, plant. (a kind of running-total group by or like an Oracle 'over partition' function)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have only movement (goods issue and goods receipt qty) by plant, material, date...in SAP source, and i have the starting qty for the same dimensions...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so the cumulative value per material, plant, date... would be the stock start value + sum of all mvts (GR-GI) up to the current processed date in the load script....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This cumulative value represents the value of the stock for this date, this plant, this material... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a graph, it would be something like :rangesum&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;above&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Stock_Variance&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), 0, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;rowno&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Total&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If I could load it in a table with a script, It would be easier to retrieve the stock value for any period selected...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Is there any way to use the rangesum function in a script with 'group by' features ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Many thanks for your support,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Chris&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 14:14:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429616#M160139</guid>
      <dc:creator />
      <dc:date>2012-09-21T14:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum 'grouped by' in load script ?</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429617#M160140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of above, you can use peek in your script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alse check this topic:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="loading" href="https://community.qlik.com/message/80305#80305"&gt;http://community.qlik.com/message/80305#80305&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 15:00:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429617#M160140</guid>
      <dc:creator />
      <dc:date>2012-09-21T15:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum 'grouped by' in load script ?</title>
      <link>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429618#M160141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE_ITEMS:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINE_ITEM_ID, DATE_INTEGER, QUANTITY, PRICE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3764793, 41129411956019, 1, 4376&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3764793, 41129457546296, 1, 356&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3764793, 41129481006944, 1, 4019&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3815241, 41148484849537, 1, 312.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3815241, 41149623449074, 1, 329.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3815241, 41150513599537, 1, 312.00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3728772, 41151676979167, 1, 104.67&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3728772, 41136601608796, 3, 104.67&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3764793, 41129645358796, 4, 1004&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3728772, 41134304803241, 4, 287.85&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEST:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINE_ITEM_ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE_INTEGER,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(PRICE) + If(IsNull(Peek('Cumulative')), 0, Peek('Cumulative')) AS Cumulative&lt;/P&gt;&lt;P&gt;Resident LINE_ITEMS&lt;/P&gt;&lt;P&gt;GROUP BY LINE_ITEM_ID, DATE_INTEGER;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE LINE_ITEMS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 15:27:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cumulative-sum-grouped-by-in-load-script/m-p/429618#M160141</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-09-21T15:27:13Z</dc:date>
    </item>
  </channel>
</rss>

