<?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 of seqential numbers? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382479#M142722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I run the expression as it stands I get in SEQCOUNT a count of DOSINGDAY (albeit as a count (SEQUENTAL)), not a count of the maximum sequential days that a patient recieved treatment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Aug 2012 15:28:37 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-08-30T15:28:37Z</dc:date>
    <item>
      <title>Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382471#M142714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to figure out how to make a count of and then find the max of only groups of sequential numbers. Ideally for the load script but in a function is fine too.&lt;/P&gt;&lt;P&gt;The data looks like this...&lt;/P&gt;&lt;P&gt; PatientID , TreatmentDay&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,3&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,4&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,6&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,7&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,8&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,1&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,2&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,3&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,4&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct value for patient1 would be 4 and for&amp;nbsp; patient 2 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attach a xls to this post with a basic data set in,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 13:33:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382471#M142714</guid>
      <dc:creator />
      <dc:date>2012-08-30T13:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382472#M142715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;input:&lt;/P&gt;&lt;P&gt;LOAD TESTSYSTEMID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSINGDAY&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[day seq.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seqfalgs:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; TESTSYSTEMID,&lt;/P&gt;&lt;P&gt; DOSINGDAY,&lt;/P&gt;&lt;P&gt; if((DOSINGDAY=previous(DOSINGDAY)+1 and TESTSYSTEMID=previous(TESTSYSTEMID) and peek(SEQUENTAL)&amp;lt;&amp;gt;0) or&lt;/P&gt;&lt;P&gt; (TESTSYSTEMID&amp;lt;&amp;gt;previous(TESTSYSTEMID)), 1, 0)&amp;nbsp; as SEQUENTAL&lt;/P&gt;&lt;P&gt;Resident input;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seqcount:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; TESTSYSTEMID,&lt;/P&gt;&lt;P&gt; SUM(SEQUENTAL) as SEQCOUNT&lt;/P&gt;&lt;P&gt;Resident seqfalgs&lt;/P&gt;&lt;P&gt;group by TESTSYSTEMID;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 13:56:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382472#M142715</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T13:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382473#M142716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much. But it doesnt seem to work correctly. There are only SEQENTAL counts of 0 and 1. I'll dive in to your script and have a think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 14:05:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382473#M142716</guid>
      <dc:creator />
      <dc:date>2012-08-30T14:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382474#M142717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look carefuly.&lt;/P&gt;&lt;P&gt;The result is in&amp;nbsp; SEQCOUNT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 14:08:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382474#M142717</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T14:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382475#M142718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems to be the ...&lt;/P&gt;&lt;P&gt;or (TESTSYSTEMID&amp;lt;&amp;gt;previous(TESTSYSTEMID)) &lt;/P&gt;&lt;P&gt;statement that was screwing things around. I've removed this and things are looking pretty rosy.&lt;/P&gt;&lt;P&gt;I've just got to find the max of unique SEQENTALs and things are good.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 14:20:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382475#M142718</guid>
      <dc:creator />
      <dc:date>2012-08-30T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382476#M142719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should replace it with&lt;/P&gt;&lt;P&gt;or (TESTSYSTEMID&amp;lt;&amp;gt;previous(TESTSYSTEMID) and DOSINGDAY=1)&lt;/P&gt;&lt;P&gt;or it will skip all first values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 14:41:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382476#M142719</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T14:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382477#M142720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is looking good. But I have an issue when I tried it with a bigger data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If one of the patients has 3 days of sequential treatments then a break then 5 days of sequential treatments the function we have gives a value of 8. Whereas the value I am after is 5 in that case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will amend the data set in the original xls file so that patient1 has this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 15:07:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382477#M142720</guid>
      <dc:creator />
      <dc:date>2012-08-30T15:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382478#M142721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've already post you the right expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((DOSINGDAY=previous(DOSINGDAY)+1 and TESTSYSTEMID=previous(TESTSYSTEMID) and &lt;/P&gt;&lt;P&gt;peek(SEQUENTAL)&amp;lt;&amp;gt;0) or (TESTSYSTEMID&amp;lt;&amp;gt;previous(TESTSYSTEMID) and DOSINGDAY=1), 1, 0)&amp;nbsp; as SEQUENTAL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 15:13:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382478#M142721</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T15:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382479#M142722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I run the expression as it stands I get in SEQCOUNT a count of DOSINGDAY (albeit as a count (SEQUENTAL)), not a count of the maximum sequential days that a patient recieved treatment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 15:28:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382479#M142722</guid>
      <dc:creator />
      <dc:date>2012-08-30T15:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382480#M142723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is wrong ?&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21009" class="jive-image" alt="day seq.png" src="/legacyfs/online/21009_day seq.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 15:32:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382480#M142723</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T15:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382481#M142724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well TESTSYSTEM 1 has 5 DOSINGDAY s that are sequential Day3-7. So the count for that individual should be 5.&lt;/P&gt;&lt;P&gt;TESTSYSTEM 2 has 6 sequential days Day1-6&lt;/P&gt;&lt;P&gt;TESTSYSTEM 3 has 6 sequential days Day1-6&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 15:38:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382481#M142724</guid>
      <dc:creator />
      <dc:date>2012-08-30T15:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382482#M142725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I thought you want only those that starts from 1 &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;if((DOSINGDAY=previous(DOSINGDAY)+1 and TESTSYSTEMID=previous(TESTSYSTEMID) &lt;SPAN style="text-decoration: line-through;"&gt;and &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;peek(SEQUENTAL)&amp;lt;&amp;gt;0&lt;/SPAN&gt;) or (TESTSYSTEMID&amp;lt;&amp;gt;previous(TESTSYSTEMID) &lt;SPAN style="text-decoration: line-through;"&gt;and DOSINGDAY=1&lt;/SPAN&gt;), 1, 0)&amp;nbsp; as SEQUENTAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if there will be two sets of sequental days it will sum it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 15:50:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382482#M142725</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T15:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382483#M142726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes cheers, I had amended your code to to do the same. Ideally I would like to just find the max of each "group"&amp;nbsp; of sequential values rather than the sum. I'll think about it over the weekend. Thanks agina!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 16:02:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382483#M142726</guid>
      <dc:creator />
      <dc:date>2012-08-30T16:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382484#M142727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I hope thats final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input:&lt;/P&gt;&lt;P&gt;LOAD TESTSYSTEMID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSINGDAY&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[day seq.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seqfalgs:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; TESTSYSTEMID,&lt;/P&gt;&lt;P&gt; DOSINGDAY,&lt;/P&gt;&lt;P&gt; if(TESTSYSTEMID=previous(TESTSYSTEMID), if(DOSINGDAY-previous(DOSINGDAY)=1, 1, 0), 0) as SEQUENTAL&lt;/P&gt;&lt;P&gt;Resident input&lt;/P&gt;&lt;P&gt;order by TESTSYSTEMID, DOSINGDAY;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seqstring:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; TESTSYSTEMID,&lt;/P&gt;&lt;P&gt; Concat(SEQUENTAL, '', DOSINGDAY) as SEQSTRING&lt;/P&gt;&lt;P&gt;Resident seqfalgs&lt;/P&gt;&lt;P&gt;group by TESTSYSTEMID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sunseqs:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; TESTSYSTEMID,&lt;/P&gt;&lt;P&gt; len(SubField(SEQSTRING, '0'))+1 as SEQLEN&lt;/P&gt;&lt;P&gt;Resident seqstring;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; TESTSYSTEMID,&lt;/P&gt;&lt;P&gt; Max(SEQLEN) as MAXSEQLEN&lt;/P&gt;&lt;P&gt;Resident sunseqs&lt;/P&gt;&lt;P&gt;group by TESTSYSTEMID;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 16:09:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382484#M142727</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-08-30T16:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count of seqential numbers?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382485#M142728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dude you are awesome. Thanks for the code, plus, by looking at your code, I've learnt alot about loading data, so even more thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Aug 2012 16:14:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-seqential-numbers/m-p/382485#M142728</guid>
      <dc:creator />
      <dc:date>2012-08-30T16:14:45Z</dc:date>
    </item>
  </channel>
</rss>

