<?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: Accumulate values until next occurrence in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22528#M772777</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invoice No, Invoice Line, MTO_Key, %Cus_Ref, %Prod_Code, Value, MTO&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*1, 10808677-1, CHO006, 31656, 0.00, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*2, 10808677-0, CHO006, EXOG-CURL-15229, 61.52, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*3, 10808677-0, CHO006, EXOG-CUSH-PIP43, 5.58, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*4, 10808677-1, CHO006, 31844, 0.00, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*5, 10808677-0, CHO006, EXOC-CUSH-PIP43, 4.31, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*6, 10808677-0, CHO006, EXOC-TIEB-PIP, 7.52, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*7, 10808677-0, CHO006, SPEC-CARRIAGE, 8.00, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; If([Invoice No] = Previous([Invoice No]),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; If(Previous(MTO) = 1, Value, RangeSum(Peek('NewValue'), Value)), Value) as NewValue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;Order By [Invoice No], [Invoice Line] desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2018 02:14:20 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-05-29T02:14:20Z</dc:date>
    <item>
      <title>Accumulate values until next occurrence</title>
      <link>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22527#M772776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="262" style="width: 658px; height: 262px;" width="658"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="94"&gt;Invoice No&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="84"&gt;Invoice Line&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="81"&gt;MTO_Key&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="51"&gt;%Cus_Ref&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="112"&gt;%Prod_Code&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="41"&gt;Value&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="28"&gt;MTO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;31656&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0.00&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-0&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;EXOG-CURL-15229&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;61.52&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*3&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-0&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;EXOG-CUSH-PIP43&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;5.58&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*4&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;31844&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0.00&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*5&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-0&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;EXOC-CUSH-PIP43&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;4.31&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*6&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-0&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;EXOC-TIEB-PIP&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;7.52&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;10808677&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677*7&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;10808677-0&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;CHO006&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;SPEC-CARRIAGE&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;8.00&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi, in the table above I need to accumulate the value in field Value until the the next occurrence of MTO and then apply the accumulated value to the lines where MTO = 1. So the end result should see line 1 = 67.10 (line1 + line2 + line3), and line 4 as 19.83 (line4 + line5 + line6 + line7). I have tried various attempts using previous and peek without success. Any suggestions would be most welcome. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22527#M772776</guid>
      <dc:creator>stuartbeet</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulate values until next occurrence</title>
      <link>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22528#M772777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invoice No, Invoice Line, MTO_Key, %Cus_Ref, %Prod_Code, Value, MTO&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*1, 10808677-1, CHO006, 31656, 0.00, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*2, 10808677-0, CHO006, EXOG-CURL-15229, 61.52, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*3, 10808677-0, CHO006, EXOG-CUSH-PIP43, 5.58, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*4, 10808677-1, CHO006, 31844, 0.00, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*5, 10808677-0, CHO006, EXOC-CUSH-PIP43, 4.31, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*6, 10808677-0, CHO006, EXOC-TIEB-PIP, 7.52, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10808677, 10808677*7, 10808677-0, CHO006, SPEC-CARRIAGE, 8.00, 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; If([Invoice No] = Previous([Invoice No]),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; If(Previous(MTO) = 1, Value, RangeSum(Peek('NewValue'), Value)), Value) as NewValue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;Order By [Invoice No], [Invoice Line] desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 02:14:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22528#M772777</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-29T02:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulate values until next occurrence</title>
      <link>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22529#M772778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sunny, I'll give it try and revert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 16:24:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22529#M772778</guid>
      <dc:creator>stuartbeet</dc:creator>
      <dc:date>2018-05-29T16:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulate values until next occurrence</title>
      <link>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22530#M772779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny, works a treat thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 16:41:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22530#M772779</guid>
      <dc:creator>stuartbeet</dc:creator>
      <dc:date>2018-05-29T16:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulate values until next occurrence</title>
      <link>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22531#M772780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem at all &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 16:42:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Accumulate-values-until-next-occurrence/m-p/22531#M772780</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-29T16:42:01Z</dc:date>
    </item>
  </channel>
</rss>

