<?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: Consecutive count in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459872#M796294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count consecutive months not upto maximum 5 months. I need to &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;calculate the number of consecutive months starting from the last month in a straight table expression.&lt;/SPAN&gt;&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;&lt;BR /&gt;&lt;/SPAN&gt;&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;Thanks,&lt;/SPAN&gt;&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;Siva.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 07 Jan 2018 00:47:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-01-07T00:47:17Z</dc:date>
    <item>
      <title>Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459868#M796290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just want to count only the consecutive values based on maximum month-year (from descending order).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, 5 months are consecutive in the below screenshot based on the maximum month-year (Dec-2017) descending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here we don't have Jul-2017 after Aug-2017. So, the count will be 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Screenshot_1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/189115_Screenshot_1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached sample QVW and data in excel. Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siva. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459868#M796290</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459869#M796291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That means, you want to count only for Max 5 months? &lt;SPAN style="font-size: 10pt;"&gt;May be &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;STRONG style="font-size: 10pt;"&gt;=Count({&amp;lt;[Month-Year] = {"&amp;gt;=$(=AddMonths(Max([Month-Year]),-5))&amp;lt;=$(=Max([Month-Year]))"}&amp;gt;} [Month-Year])&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jan 2018 02:00:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459869#M796291</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-01-06T02:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459870#M796292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use this expression to calculate the number of consecutive months starting from the last month:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Index(Concat(Aggr(-(AddMonths(Below(total [Month Year],1),-1)=AddMonths(Below(total [Month Year],2),-2)),ID,[Month Year]),'',-[Month Year]),'0',2)-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can be put as it is in a text box or as a title or caption.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jan 2018 21:15:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459870#M796292</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-01-06T21:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459871#M796293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Peter. It's working, but if year changes it's not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, after Jan-2018, it's not counting Dec-2017. Do we need to change the expression for it accordingly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I can't use this expression in straight table expressions. Please help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jan 2018 00:31:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459871#M796293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-07T00:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459872#M796294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count consecutive months not upto maximum 5 months. I need to &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;calculate the number of consecutive months starting from the last month in a straight table expression.&lt;/SPAN&gt;&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;&lt;BR /&gt;&lt;/SPAN&gt;&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;Thanks,&lt;/SPAN&gt;&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;Siva.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jan 2018 00:47:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459872#M796294</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-07T00:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459873#M796295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tested the expression with various dates and it worked well for me across years. I tested it specifically with both Jan-2018 and earlier... Are your dates real dates? The dates I tested with are actual dates - every month is based on being the 1st of every month.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jan 2018 00:54:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459873#M796295</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-01-07T00:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459874#M796296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want it to work on each row in a straight table you just have to add total in the Concat function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Index(Concat(&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;total&lt;/STRONG&gt;&lt;/SPAN&gt; Aggr(-(AddMonths(Below(total YM,1),-1)=AddMonths(Below(total YM,2),-2)),ID,YM),'',-YM),'0',2)-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the QlikView application so you can have a look.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jan 2018 01:19:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459874#M796296</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-01-07T01:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459875#M796297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With TOTAL key it will help? Chek Petter solution which is updated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jan 2018 02:57:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459875#M796297</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-01-07T02:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459876#M796298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day Guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So sorry to resurrect this, please have mercy if im breaking any rules &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;How would the query change if the data and output changes the following? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="examplexls.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/215435_examplexls.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2018 08:23:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459876#M796298</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-09T08:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Consecutive count</title>
      <link>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459877#M796299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check there &lt;A href="https://community.qlik.com/thread/316299"&gt;Count consecutive months.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2018 03:49:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Consecutive-count/m-p/1459877#M796299</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-10-10T03:49:33Z</dc:date>
    </item>
  </channel>
</rss>

