<?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: Sum the last 4 values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703196#M725501</link>
    <description>&lt;P&gt;Hello Vergar, how are you?&lt;/P&gt;&lt;P&gt;Thanks for your help, but it's not working!&lt;BR /&gt;&lt;BR /&gt;I believe the solution is easier than I'm trying to explain, but It's difficult to explain by text.&lt;BR /&gt;Are you available for a 30 minutes call via Skype?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for your time&lt;/P&gt;</description>
    <pubDate>Mon, 18 May 2020 18:43:07 GMT</pubDate>
    <dc:creator>brunolelli87</dc:creator>
    <dc:date>2020-05-18T18:43:07Z</dc:date>
    <item>
      <title>Sum the last 4 values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703121#M725497</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;I'm here again facing lots of problems trying to use QlikView...&lt;/P&gt;&lt;P&gt;How can I sum the last 4 values different to zero?&lt;BR /&gt;&lt;BR /&gt;Check this sample chart:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Date&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;LOPP&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;This is what I'm looking for&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;18/05/2020&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;0&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;3+1+5+3 = 12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;17/05/2020&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1+5+3+1 = 10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;16/05/2020&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;0&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1+5+3+1 = 10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;15/05/2020&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;5+3+1 = 9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;14/05/2020&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;5&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;3+1 = 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;13/05/2020&lt;/TD&gt;&lt;TD height="25px"&gt;0&lt;/TD&gt;&lt;TD height="25px"&gt;3+1 = 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;12/05/2020&lt;/TD&gt;&lt;TD height="25px"&gt;0&lt;/TD&gt;&lt;TD height="25px"&gt;3+1 = 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;11/05/2020&lt;/TD&gt;&lt;TD height="25px"&gt;3&lt;/TD&gt;&lt;TD height="25px"&gt;1 = 1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;10/05/2020&lt;/TD&gt;&lt;TD height="25px"&gt;1&lt;/TD&gt;&lt;TD height="25px"&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do it?&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703121#M725497</guid>
      <dc:creator>brunolelli87</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum the last 4 values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703192#M725499</link>
      <description>&lt;P&gt;Any Help?&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 18:24:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703192#M725499</guid>
      <dc:creator>brunolelli87</dc:creator>
      <dc:date>2020-05-18T18:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum the last 4 values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703193#M725500</link>
      <description>&lt;P&gt;Maybe you can do the expression Sum(LOPP), but in the table expression properties choose to accumulate by 4 steps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Read more inain the Accumulation section in this help page:&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Straight_Table.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Straight_Table.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 18:26:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703193#M725500</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-05-18T18:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum the last 4 values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703196#M725501</link>
      <description>&lt;P&gt;Hello Vergar, how are you?&lt;/P&gt;&lt;P&gt;Thanks for your help, but it's not working!&lt;BR /&gt;&lt;BR /&gt;I believe the solution is easier than I'm trying to explain, but It's difficult to explain by text.&lt;BR /&gt;Are you available for a 30 minutes call via Skype?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for your time&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 18:43:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703196#M725501</guid>
      <dc:creator>brunolelli87</dc:creator>
      <dc:date>2020-05-18T18:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sum the last 4 values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703202#M725502</link>
      <description>&lt;P&gt;One solution in&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SET DateFormat='D/M/YYYY';

tab1:
LOAD * INLINE [
    Date, LOPP
    18/5/2020, 0
    17/5/2020, 3
    16/5/2020, 0
    15/5/2020, 1
    14/5/2020, 5
    13/5/2020, 0
    12/5/2020, 0
    11/5/2020, 3
    10/5/2020, 1
]
;

tab2:
LOAD *, RangeSum(K1, K2, K3, K4) As Last4Sum
;
LOAD *, If(Peek('LOPP')=0,Peek('K1'),Peek('LOPP')) As K1
	  , If(Peek('LOPP')=0,Peek('K2'),Peek('K1')) As K2
	  , If(Peek('LOPP')=0,Peek('K3'),Peek('K2')) As K3
	  , If(Peek('LOPP')=0,Peek('K4'),Peek('K3')) As K4
Resident tab1
Order By Date
;	  	  	  

Drop Table tab1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 19:08:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703202#M725502</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2020-05-18T19:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sum the last 4 values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703205#M725503</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commQV02.JPG" style="width: 198px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/33897iB643B59E1640181E/image-size/large?v=v2&amp;amp;px=999" role="button" title="commQV02.JPG" alt="commQV02.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 19:11:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-the-last-4-values/m-p/1703205#M725503</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2020-05-18T19:11:04Z</dc:date>
    </item>
  </channel>
</rss>

