<?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: how to calculate sum of last two months in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981737#M959372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tab:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data , Month&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Sum(Data) as Total,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Month &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Tab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By Month;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Join(Tab)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD If(Month = Previous(Month) + 1, RangeSum(Total, Previous(Total))) as CumulativeTotal,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Month&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/103349_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Oct 2015 13:58:49 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2015-10-28T13:58:49Z</dc:date>
    <item>
      <title>how to calculate sum of last two months in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981736#M959371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to calculate the sum of values of last two months in script.Here i am attaching the code and the sample application for reference.&lt;/P&gt;&lt;P&gt;Please go through it and help me.&lt;/P&gt;&lt;P&gt;for eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tab:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD * Inline [&lt;/P&gt;&lt;P&gt;Data , Month&lt;/P&gt;&lt;P&gt;2, 1&lt;/P&gt;&lt;P&gt;2,1&lt;/P&gt;&lt;P&gt;4, 2&lt;/P&gt;&lt;P&gt;5, 2&lt;/P&gt;&lt;P&gt;1, 3&lt;/P&gt;&lt;P&gt;2,4 ];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have the above sample data and i need to sum of two previous months say if i select month 2 then it should show the sum of previous two months say 1 ,2 and sum should be 13 in total for this selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to achieve the above result by script only not on frontend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vasudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 13:37:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981736#M959371</guid>
      <dc:creator />
      <dc:date>2015-10-28T13:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate sum of last two months in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981737#M959372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Tab:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data , Month&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Sum(Data) as Total,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Month &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Tab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By Month;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Join(Tab)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD If(Month = Previous(Month) + 1, RangeSum(Total, Previous(Total))) as CumulativeTotal,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Month&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/103349_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 13:58:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981737#M959372</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-10-28T13:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate sum of last two months in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981738#M959373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.qlik.com/qlik-users/171708"&gt;sunindia&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2015 07:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981738#M959373</guid>
      <dc:creator />
      <dc:date>2015-10-29T07:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate sum of last two months in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981739#M959374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want same like this , but for me i want 3 fields, &lt;/P&gt;&lt;P&gt;1 should give 1 month previous sum &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2nd&amp;nbsp; should give 2 month previous sum &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;3rd&amp;nbsp; should give 3 month previous sum &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;and i have year field also so when january month came then it should sum with last year december also.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;can it possible in script ?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2017 01:23:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981739#M959374</guid>
      <dc:creator>agni_gold</dc:creator>
      <dc:date>2017-07-04T01:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate sum of last two months in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981740#M959375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes it is possible by using MasterCalendar with Rolling months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And You can do separate calculation for all by using rolling 2,3,...etc. and do the join based on Key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Current Month&lt;/P&gt;&lt;P&gt;AsOfMonth:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;'Current' as RollingType,&lt;/P&gt;&lt;P&gt;Period as AsOfPeriod,&lt;/P&gt;&lt;P&gt;Period as Period&lt;/P&gt;&lt;P&gt;Resident Calendar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Rolling 3 month&lt;/P&gt;&lt;P&gt;AsOfMonth:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;'R3M' as RollingType,&lt;/P&gt;&lt;P&gt;Period as AsOfPeriod,&lt;/P&gt;&lt;P&gt;AddMonths(Period,1 - IterNo()) as Period&lt;/P&gt;&lt;P&gt;Resident Calendar&lt;/P&gt;&lt;P&gt;while IterNo() -1 &amp;lt; 3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you can use doing join with facttable and groupby. If you want separate column then each time you need to load specific rolling type and follow the process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2017 03:40:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-calculate-sum-of-last-two-months-in-script/m-p/981740#M959375</guid>
      <dc:creator>balar025</dc:creator>
      <dc:date>2017-07-04T03:40:06Z</dc:date>
    </item>
  </channel>
</rss>

