<?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: Cumulative sum in Load Script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137163#M9637</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try below script&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;Index(Incurred,'-') as count&lt;/P&gt;&lt;P&gt;Inline[&lt;/P&gt;&lt;P&gt;ID,Month,Incurred&lt;/P&gt;&lt;P&gt;1,Jan-18,1000&lt;/P&gt;&lt;P&gt;2,Jan-18,500&lt;/P&gt;&lt;P&gt;3,Jan-18,-20&lt;/P&gt;&lt;P&gt;4,Jan-18,35&lt;/P&gt;&lt;P&gt;5,Jan-18,60&lt;/P&gt;&lt;P&gt;6,Jan-18,-300&lt;/P&gt;&lt;P&gt;1,Feb-18,1500&lt;/P&gt;&lt;P&gt;3,Feb-18,-20&lt;/P&gt;&lt;P&gt;4,Feb-18,-65&lt;/P&gt;&lt;P&gt;5,Feb-18,1500&lt;/P&gt;&lt;P&gt;6,Feb-18,-300&lt;/P&gt;&lt;P&gt;1,Mar-18,1500&lt;/P&gt;&lt;P&gt;3,Mar-18,-20&lt;/P&gt;&lt;P&gt;4,Mar-18,-65&lt;/P&gt;&lt;P&gt;5,Mar-18,1500&lt;/P&gt;&lt;P&gt;6,Mar-18,100&lt;/P&gt;&lt;P&gt;1,Apr-18,-100&lt;/P&gt;&lt;P&gt;2,Apr-18,-150&lt;/P&gt;&lt;P&gt;5,Apr-18,1550&lt;/P&gt;&lt;P&gt;6,Apr-18,-30&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(ID=Previous(ID),if(count=1,RangeSum(count,Peek('cummlative_cnt')),count),count) as cummlative_cnt &lt;/P&gt;&lt;P&gt;Resident Test&lt;/P&gt;&lt;P&gt;Order by ID,Month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP table Test;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;EXIT SCRIPT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Regards,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2018 12:38:39 GMT</pubDate>
    <dc:creator>PrashantSangle</dc:creator>
    <dc:date>2018-08-14T12:38:39Z</dc:date>
    <item>
      <title>Cumulative sum in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137162#M9636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Hi All, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Hopefully an interesting one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;I need to calculate the number of months a line has a negative incurred, but cumulatively.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;An example of the data would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;ID Month Incurred&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Jan-18 1000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;2 Jan-18 500&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;3 Jan-18 -20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;4 Jan-18 35&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Jan-18 60&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Jan-18 -300&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Feb-18 1500&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;3 Feb-18 -20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;4 Feb-18 -65&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Feb-18 1500&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Feb-18 -300&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Mar-18 1500&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;3 Mar-18 -20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;4 Mar-18 -65&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Mar-18 1500&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Mar-18 100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Apr-18 -100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;2 Apr-18 -150&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Apr-18 1550&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Apr-18 -30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;So I want a formula that would work out the number of months the ID has had a negative Incurred as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;ID Month Incurred Months Negative &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Jan-18 1000 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;2 Jan-18 500 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;3 Jan-18 -20 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;4 Jan-18 35 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Jan-18 60 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Jan-18 -300 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Feb-18 1500 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;3 Feb-18 -20 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;4 Feb-18 -65 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Feb-18 1500 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Feb-18 -300 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Mar-18 1500 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;3 Mar-18 -20 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;4 Mar-18 -65 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Mar-18 1500 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Mar-18 100 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;1 Apr-18 -100 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;2 Apr-18 -150 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;5 Apr-18 1550 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;6 Apr-18 -30 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;This is what my script looks like so far for the table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Negative Incurred Agg]:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Load&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Line ID], //Links to main data table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Line ID] as [Neg Incurred Line ID], //Allows field to be used when not linked to main table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Neg Transaction Month],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Negative Incurred],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Negative Incurred Last 12 Months],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[Negative Incurred Last 18 Months],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;IF ([Negative Incurred]&amp;lt;'0','1','0') as [Negative Incurred Count]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Load&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[NegIncLineID] as [Line ID],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[TrMonth] as [Neg Transaction Month],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;lastvalue([NegIncurred]) as [Negative Incurred],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;If([TrMonth] &amp;gt; Date(MonthStart('$(vCalendarThisMonth)', -12)) and [TrMonth] &amp;lt;= Date('$(vCalendarThisMonth)'), 1,0) as [Negative Incurred Last 12 Months],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;If([TrMonth] &amp;gt; Date(MonthStart('$(vCalendarThisMonth)', -18)) and [TrMonth] &amp;lt;= Date('$(vCalendarThisMonth)'), 1,0) as [Negative Incurred Last 18 Months]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Group by [NegIncLineID],[TrMonth]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Load&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[NegIncLineID],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;date(monthend([TrMonth]),'MMM YYYY') as [TrMonth],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;[NegIncurred]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Load &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;ID as [NegIncLineID],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;TrDate as [TrMonth],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;Incurred as [NegIncurred]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;resident MissingDatesData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #343a41; font-family: 'Segoe UI WestEuropean', 'Segoe UI', 'Segoe UI Emoji', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif; font-size: 15px;"&gt;I was thinking possibly a peek using the negative incurred count field?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 10:46:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137162#M9636</guid>
      <dc:creator>nathan4988</dc:creator>
      <dc:date>2018-08-14T10:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137163#M9637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try below script&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;Index(Incurred,'-') as count&lt;/P&gt;&lt;P&gt;Inline[&lt;/P&gt;&lt;P&gt;ID,Month,Incurred&lt;/P&gt;&lt;P&gt;1,Jan-18,1000&lt;/P&gt;&lt;P&gt;2,Jan-18,500&lt;/P&gt;&lt;P&gt;3,Jan-18,-20&lt;/P&gt;&lt;P&gt;4,Jan-18,35&lt;/P&gt;&lt;P&gt;5,Jan-18,60&lt;/P&gt;&lt;P&gt;6,Jan-18,-300&lt;/P&gt;&lt;P&gt;1,Feb-18,1500&lt;/P&gt;&lt;P&gt;3,Feb-18,-20&lt;/P&gt;&lt;P&gt;4,Feb-18,-65&lt;/P&gt;&lt;P&gt;5,Feb-18,1500&lt;/P&gt;&lt;P&gt;6,Feb-18,-300&lt;/P&gt;&lt;P&gt;1,Mar-18,1500&lt;/P&gt;&lt;P&gt;3,Mar-18,-20&lt;/P&gt;&lt;P&gt;4,Mar-18,-65&lt;/P&gt;&lt;P&gt;5,Mar-18,1500&lt;/P&gt;&lt;P&gt;6,Mar-18,100&lt;/P&gt;&lt;P&gt;1,Apr-18,-100&lt;/P&gt;&lt;P&gt;2,Apr-18,-150&lt;/P&gt;&lt;P&gt;5,Apr-18,1550&lt;/P&gt;&lt;P&gt;6,Apr-18,-30&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(ID=Previous(ID),if(count=1,RangeSum(count,Peek('cummlative_cnt')),count),count) as cummlative_cnt &lt;/P&gt;&lt;P&gt;Resident Test&lt;/P&gt;&lt;P&gt;Order by ID,Month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP table Test;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;EXIT SCRIPT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Regards,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 12:38:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137163#M9637</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2018-08-14T12:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137164#M9638</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;TempTable:&lt;/P&gt;&lt;P&gt;Load ID,&lt;/P&gt;&lt;P&gt;Incurred,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month,&lt;/P&gt;&lt;P&gt;if (Incurred &amp;lt; 0, 1, 0) as FlagIncurred //every negative Incurred gets a Flag; we use this to sum them up&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Load ID, Month, Incurred&lt;/P&gt;&lt;P&gt;Inline [&lt;/P&gt;&lt;P&gt;ID,Month,Incurred&lt;/P&gt;&lt;P&gt;1,Jan-18,1000&lt;/P&gt;&lt;P&gt;2,Jan-18,500&lt;/P&gt;&lt;P&gt;3,Jan-18,-20&lt;/P&gt;&lt;P&gt;4,Jan-18,35&lt;/P&gt;&lt;P&gt;5,Jan-18,60&lt;/P&gt;&lt;P&gt;6,Jan-18,-300&lt;/P&gt;&lt;P&gt;1,Feb-18,1500&lt;/P&gt;&lt;P&gt;3,Feb-18,-20&lt;/P&gt;&lt;P&gt;4,Feb-18,-65&lt;/P&gt;&lt;P&gt;5,Feb-18,1500&lt;/P&gt;&lt;P&gt;6,Feb-18,-300&lt;/P&gt;&lt;P&gt;1,Mrz-18,1500&lt;/P&gt;&lt;P&gt;3,Mrz-18,-20&lt;/P&gt;&lt;P&gt;4,Mrz-18,-65&lt;/P&gt;&lt;P&gt;5,Mrz-18,1500&lt;/P&gt;&lt;P&gt;6,Mrz-18,100&lt;/P&gt;&lt;P&gt;1,Apr-18,-100&lt;/P&gt;&lt;P&gt;2,Apr-18,-150&lt;/P&gt;&lt;P&gt;5,Apr-18,1550&lt;/P&gt;&lt;P&gt;6,Apr-18,-30&lt;/P&gt;&lt;P&gt;6,Apr-18,-40&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//because we need to sort the table we need to reload the data in a new table&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;ID,&lt;/P&gt;&lt;P&gt;Incurred,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(peek(ID)=ID, if(not Peek(Month) = Month, peek(runningIncurred) + FlagIncurred, peek(runningIncurred)),FlagIncurred) as runningIncurred, //this counts every month only once&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(peek(ID)=ID, peek(runningIncurred) + FlagIncurred, FlagIncurred) as runningIncurredMultiple //this counts month multiple times&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Resident TempTable&lt;/P&gt;&lt;P&gt;order by ID //, Month /* you have to sort by month, but it has to be a date field. */&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table TempTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exit Script;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 13:59:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137164#M9638</guid>
      <dc:creator>Lesny_Eva</dc:creator>
      <dc:date>2018-08-14T13:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137165#M9639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. This worked really well. I had to tweak it slightly as I wanted it to reset back to zero when it was no longer negative.&lt;/P&gt;&lt;P&gt;So I added in:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(peek(ID)=ID and &lt;STRONG&gt;&lt;EM&gt;Incurred&amp;lt;=0&lt;/EM&gt;&lt;/STRONG&gt;, peek(runningIncurred) + FlagIncurred, FlagIncurred) as runningIncurredMultiple //this counts month multiple times&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2018 08:40:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-sum-in-Load-Script/m-p/137165#M9639</guid>
      <dc:creator>nathan4988</dc:creator>
      <dc:date>2018-08-16T08:40:34Z</dc:date>
    </item>
  </channel>
</rss>

