<?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: count consecutive in table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666437#M1088817</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Irene,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sure it's possible.&lt;/P&gt;&lt;P&gt;You have to do it in the script, using the PEEK() or PREVIOUS() function.&lt;/P&gt;&lt;P&gt;- Generate a binary field (1 or 0)&lt;/P&gt;&lt;P&gt;- Generate a condition stating that&lt;/P&gt;&lt;P&gt;&amp;nbsp; - the record above must (in that "result" field) have the same value as the current one&lt;/P&gt;&lt;P&gt;&amp;nbsp; - the value (in the newly created field) in the record above must be 1.&lt;/P&gt;&lt;P&gt;- You have to modify the condition for the very first record (just put a static 1 in that one) since there is none above, so the PREVIOUS() fct will fail there -&amp;gt; and in all consecutive records, too, if you don't account for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jun 2014 11:51:38 GMT</pubDate>
    <dc:creator>datanibbler</dc:creator>
    <dc:date>2014-06-12T11:51:38Z</dc:date>
    <item>
      <title>count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666435#M1088815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;do you know how to count consecutive values in a straight or pivot table??? I mean, suppose you have a straight table like the following one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;year&amp;nbsp;&amp;nbsp;&amp;nbsp; month&amp;nbsp;&amp;nbsp;&amp;nbsp; result&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 03&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SERIES&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 05&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SERIES&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 06&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 08&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHER&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARIMA&lt;/P&gt;&lt;P&gt;2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 03&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHER&lt;/P&gt;&lt;P&gt;2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SERIES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to have such a resulting table, with counting results aggr per Year:&lt;/P&gt;&lt;P&gt;2013&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;2014&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is 2013 has the first 3 values equals to each other, while the following are different, so I don't need them; 2014 has its first 2 values equals to each other, while the others are different...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it possible to do that without macros? maybe using aggr and above???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank u all guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;greetings&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 11:41:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666435#M1088815</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-12T11:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666436#M1088816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had not read the end of the question. &lt;/P&gt;&lt;P&gt;The correct way would be via script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 11:47:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666436#M1088816</guid>
      <dc:creator>felipe_dutra</dc:creator>
      <dc:date>2014-06-12T11:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666437#M1088817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Irene,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sure it's possible.&lt;/P&gt;&lt;P&gt;You have to do it in the script, using the PEEK() or PREVIOUS() function.&lt;/P&gt;&lt;P&gt;- Generate a binary field (1 or 0)&lt;/P&gt;&lt;P&gt;- Generate a condition stating that&lt;/P&gt;&lt;P&gt;&amp;nbsp; - the record above must (in that "result" field) have the same value as the current one&lt;/P&gt;&lt;P&gt;&amp;nbsp; - the value (in the newly created field) in the record above must be 1.&lt;/P&gt;&lt;P&gt;- You have to modify the condition for the very first record (just put a static 1 in that one) since there is none above, so the PREVIOUS() fct will fail there -&amp;gt; and in all consecutive records, too, if you don't account for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 11:51:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666437#M1088817</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-06-12T11:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666438#M1088818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DataNibbler,&lt;/P&gt;&lt;P&gt;I've already heard about that, unfortunately the values in result may vary with selections, that is Year and Month are not simple fields but are calculated to satisfy a certain interval of time, so after a selection I may find out the table I've illustrated but after another selection maybe I would have less months to analyze...&lt;/P&gt;&lt;P&gt;What can I do? Nothing's possible in presentation?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;IB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 11:58:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666438#M1088818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-12T11:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666439#M1088819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Irene,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so that table is not in the script, but it is only generated in this form on the GUI based on the user's selections?&lt;/P&gt;&lt;P&gt;Well, that makes it more complicated as the PEEK() or PREVIOUS() fcts are not available on the GUI.&lt;/P&gt;&lt;P&gt;I'm not aware of any possibility then. Sorry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 12:03:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666439#M1088819</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-06-12T12:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666440#M1088820</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;This can be achieved using rangesum and previous function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(previous(Year)=Year and previous(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;result&lt;/SPAN&gt;)=&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;result&lt;/SPAN&gt;, RangeSum(1,Peek(count)), 1) as count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;couunt will be initially having 1 and if the condition satisfies, 1 will be added to the previous count value&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 12:16:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666440#M1088820</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-12T12:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: count consecutive in table</title>
      <link>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666441#M1088821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank u anyway, I appreciate!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 13:45:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/count-consecutive-in-table/m-p/666441#M1088821</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-16T13:45:28Z</dc:date>
    </item>
  </channel>
</rss>

