<?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: Accumulation in script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33483#M2227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Newtable:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if (Previous(Asset_Number)= Asset_Number,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Previous(Month("Date"))= Month("Date"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="text-decoration: line-through;"&gt;rangesum (peek("Accumulated_KMs")), "Driven Kilometers")&lt;/STRONG&gt;&lt;SPAN style="text-decoration: line-through;"&gt;, "Driven Kilometers"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as Accumulated_KMs&lt;/P&gt;&lt;P&gt;Resident ExcelTable&lt;/P&gt;&lt;P&gt;Order By Asset_Number,"Date";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: the second bracket by peek is wrong and needs to be removed and peek needs single-quotes for the fieldname:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rangesum (peek('Accumulated_KMs'), "Driven Kilometers")&lt;/STRONG&gt;, "Driven Kilometers"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Jun 2018 10:46:37 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2018-06-15T10:46:37Z</dc:date>
    <item>
      <title>Accumulation in script</title>
      <link>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33482#M2226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to add an accumulated field in my script. The field must accumulate the total driven KMs per asset number per month. I have tried the following script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExcelTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Date",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Asset Nr" as Asset_Number,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Driven Kilometers",&lt;/P&gt;&lt;P&gt;FROM [lib://Data_Qlik /Qlik Kilometers 2.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is All);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Newtable:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if (Previous(Asset_Number)= Asset_Number, if (Previous(Month("Date"))= Month("Date"),rangesum (peek("Driven Kilometers"))+"Driven Kilometers", "Driven Kilometers")) as Accumulated_KMs&lt;/P&gt;&lt;P&gt;Resident ExcelTable&lt;/P&gt;&lt;P&gt;Order By Asset_Number,"Date";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me the sum of yesterday's driven KMs and today's driven KMs, but it does not sum the whole month's driven KMs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I need to adjust the script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 10:28:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33482#M2226</guid>
      <dc:creator>pascaldijkshoor</dc:creator>
      <dc:date>2018-06-15T10:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulation in script</title>
      <link>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33483#M2227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Newtable:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if (Previous(Asset_Number)= Asset_Number,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Previous(Month("Date"))= Month("Date"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="text-decoration: line-through;"&gt;rangesum (peek("Accumulated_KMs")), "Driven Kilometers")&lt;/STRONG&gt;&lt;SPAN style="text-decoration: line-through;"&gt;, "Driven Kilometers"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as Accumulated_KMs&lt;/P&gt;&lt;P&gt;Resident ExcelTable&lt;/P&gt;&lt;P&gt;Order By Asset_Number,"Date";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: the second bracket by peek is wrong and needs to be removed and peek needs single-quotes for the fieldname:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rangesum (peek('Accumulated_KMs'), "Driven Kilometers")&lt;/STRONG&gt;, "Driven Kilometers"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 10:46:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33483#M2227</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-06-15T10:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulation in script</title>
      <link>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33484#M2228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does not work correct. Now the Accumulated_KMs field shows for every month only the Driven KMs of the first day of the month.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 11:11:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33484#M2228</guid>
      <dc:creator>pascaldijkshoor</dc:creator>
      <dc:date>2018-06-15T11:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulation in script</title>
      <link>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33485#M2229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you tried the modified response from Marcus?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 11:20:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33485#M2229</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-06-15T11:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulation in script</title>
      <link>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33486#M2230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I didn't copy your script right, now it works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 11:31:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Accumulation-in-script/m-p/33486#M2230</guid>
      <dc:creator>pascaldijkshoor</dc:creator>
      <dc:date>2018-06-15T11:31:42Z</dc:date>
    </item>
  </channel>
</rss>

