<?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 Acculumation in Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189293#M52235</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Oleg,&lt;BR /&gt;Thanks for helping out.&lt;BR /&gt;&lt;BR /&gt;I changed it to the following and it Loads without error, but my results are not what i expected.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Curve:&lt;BR /&gt;LOAD&lt;BR /&gt;Flight, DaystoDeparture, DepDate,&lt;BR /&gt;Sum(Sold) as Total_Booking,&lt;BR /&gt;sum(Previous(Sold)) as Prev_Sold,&lt;BR /&gt;&lt;B&gt;only(rangesum(Sold, Peek('Total_Curve'))) as Total_Curve&lt;/B&gt;&lt;BR /&gt;// numsum( Sold, peek( 'Bsum' ) ) as Bsum&lt;BR /&gt;RESIDENT Transactions&lt;BR /&gt;GROUP by Flight, DepDate, DaystoDeparture&lt;BR /&gt;&lt;B&gt;&lt;I&gt;ORDER by Flight, DepDate desc, DaystoDeparture desc&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added only() because it was giving me a syntax error, So i assumed that rangesum() was the issue.&lt;BR /&gt;when I look at the resulting loaded table. Total_Curve always equals Sum(Sold), so it looks like my Peek('Total_Curve') is not returning anything?&lt;BR /&gt;I also tried without the '' around Total_Curve and same result.&lt;/P&gt;&lt;P&gt;Any help/advice appreciated,&lt;BR /&gt;Bernard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Sep 2009 01:32:06 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-09-18T01:32:06Z</dc:date>
    <item>
      <title>Acculumation in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189291#M52233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking to accumulate a value during my Load Script&lt;/P&gt;&lt;P&gt;HERE IS MY SCRIPT&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;Transactions:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Flight, DaystoDeparture, DepDate, Sold&lt;BR /&gt;SK100, 30,09/18,6&lt;BR /&gt;SK100, 30,09/18,1&lt;BR /&gt;SK100, 20, 09/18,1&lt;BR /&gt;SK100, 10, 09/18,4&lt;BR /&gt;SK100, 5, 09/18,4&lt;BR /&gt;SK100, 1, 09/18, 5&lt;BR /&gt;DL100, 30, 09/18,4&lt;BR /&gt;DL100, 20, 09/18,2&lt;BR /&gt;DL100, 10, 09/18,8&lt;BR /&gt;DL100, 5, 09/18,8&lt;BR /&gt;DL100, 1, 09/18,10&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Curve:&lt;BR /&gt;LOAD&lt;BR /&gt;Flight, DaystoDeparture, DepDate,&lt;BR /&gt;Sum(Sold) as Total_Booking,&lt;BR /&gt;numsum( Sold, peek( 'Bsum' ) ) as Bsum&lt;BR /&gt;RESIDENT Transactions&lt;BR /&gt;GROUP by Flight, DepDate, DaystoDeparture&lt;BR /&gt;ORDER by Flight, DepDate desc, DaystoDeparture desc&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;In the QV Help there is the function numsum with the example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="hcp6"&gt;Load A, B, numsum( B, peek( 'Bsum' ) ) as Bsum...;&lt;/P&gt;&lt;P class="hcp6"&gt;creates an accumulation of B in Bsum.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P class="hcp6"&gt;&lt;/P&gt;&lt;P class="hcp6"&gt;This is what I am looking to do. It looks like I can use the 'Bsum' field in an expression even though it is created in the load statement, and not from the underlying data source.&lt;/P&gt;&lt;P class="hcp6"&gt;&lt;/P&gt;&lt;P class="hcp6"&gt;Any help apprecaited.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2009 05:42:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189291#M52233</guid>
      <dc:creator />
      <dc:date>2009-09-17T05:42:08Z</dc:date>
    </item>
    <item>
      <title>Acculumation in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189292#M52234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Function numsum has been replaced with the function RangeSum(). The rest of your assumptions are correct - you can accumulate values this way. You might want to order your data in a certain way, and if you have any other key fields (Item, or Customer, etc...) - you might need to check if the previous(key) equals to the current value of the Key.&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2009 07:29:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189292#M52234</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-09-17T07:29:36Z</dc:date>
    </item>
    <item>
      <title>Acculumation in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189293#M52235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Oleg,&lt;BR /&gt;Thanks for helping out.&lt;BR /&gt;&lt;BR /&gt;I changed it to the following and it Loads without error, but my results are not what i expected.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Curve:&lt;BR /&gt;LOAD&lt;BR /&gt;Flight, DaystoDeparture, DepDate,&lt;BR /&gt;Sum(Sold) as Total_Booking,&lt;BR /&gt;sum(Previous(Sold)) as Prev_Sold,&lt;BR /&gt;&lt;B&gt;only(rangesum(Sold, Peek('Total_Curve'))) as Total_Curve&lt;/B&gt;&lt;BR /&gt;// numsum( Sold, peek( 'Bsum' ) ) as Bsum&lt;BR /&gt;RESIDENT Transactions&lt;BR /&gt;GROUP by Flight, DepDate, DaystoDeparture&lt;BR /&gt;&lt;B&gt;&lt;I&gt;ORDER by Flight, DepDate desc, DaystoDeparture desc&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added only() because it was giving me a syntax error, So i assumed that rangesum() was the issue.&lt;BR /&gt;when I look at the resulting loaded table. Total_Curve always equals Sum(Sold), so it looks like my Peek('Total_Curve') is not returning anything?&lt;BR /&gt;I also tried without the '' around Total_Curve and same result.&lt;/P&gt;&lt;P&gt;Any help/advice appreciated,&lt;BR /&gt;Bernard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 01:32:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189293#M52235</guid>
      <dc:creator />
      <dc:date>2009-09-18T01:32:06Z</dc:date>
    </item>
    <item>
      <title>Acculumation in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189294#M52236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the problem is related to the fact that you are trying to accumulate values in the same load statement that's also aggregating using "Group BY".&lt;/P&gt;&lt;P&gt;The "Group By" syntax is quite demanding - you can only list key fields and aggregated functions there (hence the syntax error).&lt;/P&gt;&lt;P&gt;I think you need to aggregate the data first, and then reload it again using "Resident" load, to calculate your accumulated total.&lt;/P&gt;&lt;P&gt;A few things raise questions:&lt;/P&gt;&lt;P&gt;- what are you trying to do with sum(Previous(Sold)) ? I'm not sure what kind of results you might get from this function, in combination with the Group BY...&lt;/P&gt;&lt;P&gt;- What numbers are you trying to summarize under Total_Curve?&lt;/P&gt;&lt;P&gt;- Do you want your total to accumulate data across all Flights, or keep separate totals for different Flights?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bottom line - separate accumulation and aggregation into 2 different statements...&lt;/P&gt;&lt;P&gt;cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 02:03:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189294#M52236</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-09-18T02:03:51Z</dc:date>
    </item>
    <item>
      <title>Acculumation in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189295#M52237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I think i got it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 03:16:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Acculumation-in-Load-Script/m-p/189295#M52237</guid>
      <dc:creator />
      <dc:date>2009-09-18T03:16:51Z</dc:date>
    </item>
  </channel>
</rss>

