<?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: Last 2 Month Count in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82800#M13593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure thing, but remember this will make things extremely complicated...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=RangeSum(ABove(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}Aggr(If(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode) = Above(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode)), Null(),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;} OutletCode)), OutletCode, (Month, (NUMERIC)))), 0, RowNo()))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, this will only work if you have QV12 or above... or else you will need to sort Month field in the script in the ascending order.... if it is already sorted like that... then you can try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=RangeSum(ABove(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}Aggr(If(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode) = Above(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode)), Null(),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;} OutletCode)), OutletCode, Month)), 0, RowNo()))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Apr 2018 11:52:39 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-04-25T11:52:39Z</dc:date>
    <item>
      <title>Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82792#M13585</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 have created an expression in which if we select a month it counts the unique outlet from Current and last month.&lt;/P&gt;&lt;P&gt;But if we add the month in the table it starts showing the unique outlet for individual month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;State&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Count&lt;/P&gt;&lt;P&gt;AP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;State Month&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Count&lt;/P&gt;&lt;P&gt;AP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 67&lt;/P&gt;&lt;P&gt;AP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the output to be showing unique outlet for the current month and last month for each month not individual unique outlet for each month.&lt;/P&gt;&lt;P&gt;Thus if for 3 and 2 we have 100 outlet&lt;/P&gt;&lt;P&gt;2 and 1 month we have 85 unique outlet then output should be like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;State Month&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Count&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;AP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;AP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2018 05:53:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82792#M13585</guid>
      <dc:creator>rahulsingh12</dc:creator>
      <dc:date>2018-04-24T05:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82793#M13586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to share a sample where you are facing this issue for us to play around with?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2018 09:19:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82793#M13586</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-04-24T09:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82794#M13587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi Sunny,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I am attaching the Qlikview file for the reference.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;In the chart I made I wanted unique outlet count for current and last month not just for individual month as it is coming currently.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thus in month 2 I should 6 not 3.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 04:57:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82794#M13587</guid>
      <dc:creator>rahulsingh12</dc:creator>
      <dc:date>2018-04-25T04:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82795#M13588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shouldn't it be 8 instead (for month 2)? Try exp like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;RangeSum&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Above&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;OutletCode&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;) ,0,2))&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 06:24:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82795#M13588</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-04-25T06:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82796#M13589</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;We have 5 unique in Month 1 and one unique 7 from month from 2 thus 6 unique combining 1 and 2 month&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 06:33:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82796#M13589</guid>
      <dc:creator>rahulsingh12</dc:creator>
      <dc:date>2018-04-25T06:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82797#M13590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahh, the old problem. There has been a lengthy discussion on this community over this issue. With sortable aggr(), this could probably be handled I guess (never tried; just a guess). Is a script solution an option for you?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 07:57:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82797#M13590</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-04-25T07:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82798#M13591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Implementing an AsOfTable might help here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Outlet:&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; OutletCode, Month&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, 3&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;OutletToState:&lt;/STRONG&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; OutletCode, State&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, AP&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, KAR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, TN&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, HR&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, GUJ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6, J&amp;amp;K&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, MAHA&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12, JHAR&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;AsOfTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;LOAD Month as AsOfMonth,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; Month - IterNo() + 1 as Month&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;Resident Outlet&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;While Month - IterNo() + 1 &amp;gt;= 0;&lt;/STRONG&gt;&lt;/SPAN&gt;&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/200735_Capture.PNG" style="height: 174px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 09:15:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82798#M13591</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-04-25T09:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82799#M13592</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;Thanks for the reply.&lt;/P&gt;&lt;P&gt;The file I have shared is very low version of the code I have in actual file.&lt;/P&gt;&lt;P&gt;By any chance will it be possible to do it directly in chart expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 09:28:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82799#M13592</guid>
      <dc:creator>rahulsingh12</dc:creator>
      <dc:date>2018-04-25T09:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82800#M13593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure thing, but remember this will make things extremely complicated...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=RangeSum(ABove(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}Aggr(If(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode) = Above(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode)), Null(),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;} OutletCode)), OutletCode, (Month, (NUMERIC)))), 0, RowNo()))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, this will only work if you have QV12 or above... or else you will need to sort Month field in the script in the ascending order.... if it is already sorted like that... then you can try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=RangeSum(ABove(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}Aggr(If(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode) = Above(Only({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;}OutletCode)), Null(),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;} OutletCode)), OutletCode, Month)), 0, RowNo()))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 11:52:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82800#M13593</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-04-25T11:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82801#M13594</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;Thanks for the reply.&lt;/P&gt;&lt;P&gt;But the formula seems to work when I do the selection of the particular month.&lt;/P&gt;&lt;P&gt;Like if I select 2 it shows 6 but if I don't select any month or select 3 then the number of outlet for 2 becomes 3 again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:38:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82801#M13594</guid>
      <dc:creator>rahulsingh12</dc:creator>
      <dc:date>2018-04-26T10:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Last 2 Month Count</title>
      <link>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82802#M13595</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;STRONG&gt;=RangeSum(ABove(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Month&amp;gt;}Aggr(If(Only({&amp;lt;Month&amp;gt;}OutletCode) = Above(Only({&amp;lt;Month&amp;gt;}OutletCode)), Null(),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({&amp;lt;Month&amp;gt;} OutletCode)), OutletCode, (Month, (NUMERIC)))), 0, RowNo())) * Avg({&amp;lt;Month={"&amp;gt;=$(=$(vMaxMonthOneLess))&amp;lt;=$(=$(vMaxMonth))"}&amp;gt;} 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2018 11:03:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Last-2-Month-Count/m-p/82802#M13595</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-04-26T11:03:15Z</dc:date>
    </item>
  </channel>
</rss>

