<?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 unique in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163733#M631551</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another possibility:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CrossTable (Field, Value)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD RowNo() as Key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field 1, Field 2, Field 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, B, C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, A, C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, C&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;Expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count(DISTINCT Aggr(Concat(DISTINCT Value), Key))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Aug 2016 19:10:32 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-08-01T19:10:32Z</dc:date>
    <item>
      <title>Count unique</title>
      <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163731#M631549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I have the following dataset. What expression can I use in qlikview to count the unique combinations (i.e. I want Qlikview to return the value 2 because row 1 and 2 have the same combination and row 3 has a different combination. Therefore, there are 2 unique combinations in this dataset)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Field 1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333px; text-align: center; background-color: #6690bc;"&gt;Field 2&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333px; text-align: center; background-color: #6690bc;"&gt;Field 3&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2016 01:37:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163731#M631549</guid>
      <dc:creator />
      <dc:date>2016-07-28T01:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique</title>
      <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163732#M631550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created some code for you, which will do the trick. &lt;/P&gt;&lt;P&gt;Attaching qvw file &amp;amp; script separately if you only have QV personal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final result:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Screen Shot 08-01-16 at 09.00 PM.PNG" class="jive-image image-1" src="/legacyfs/online/133195_Screen Shot 08-01-16 at 09.00 PM.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Kuba&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 19:01:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163732#M631550</guid>
      <dc:creator />
      <dc:date>2016-08-01T19:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique</title>
      <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163733#M631551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another possibility:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CrossTable (Field, Value)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD RowNo() as Key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field 1, Field 2, Field 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, B, C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, A, C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, C&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;Expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count(DISTINCT Aggr(Concat(DISTINCT Value), Key))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 19:10:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163733#M631551</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-01T19:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique</title>
      <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163734#M631552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Britney,&lt;/P&gt;&lt;P&gt;My script is pretty much the same as Sunny's&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;RecNo() as RecordID,&lt;/P&gt;&lt;P&gt;*;&lt;/P&gt;&lt;P&gt;LOAD [Field 1], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Field 2], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Field 3]&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2061" data-containertype="14" data-objectid="226893" data-objecttype="1" href="https://community.qlik.com/thread/226893"&gt;https://community.qlik.com/thread/226893&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CrossData:&lt;/P&gt;&lt;P&gt;CrossTable(Field,Value) LOAD * Resident Data;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I arrived at a different expression:&lt;/P&gt;&lt;P&gt;=Count(DISTINCT Aggr(Concat(Value,'|',Value), RecordID))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I reckon the third parameter in the concat function is required to ensure that different permutations of the same values are sorted so that say Field1,2,3 values of A,C,B and C,A,B are both concatenated to read A|B|C. also the DISTINCT clause is in a different place.&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;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 20:11:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163734#M631552</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2016-08-01T20:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique</title>
      <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163735#M631553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/people/effinty2112"&gt;effinty2112&lt;/A&gt;‌ - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think the third parameter is necessary because concat() function usually sort in ascending sort order of the field. So even without Value provided, both the first the second row will be ABC, ABC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 20:13:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163735#M631553</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-01T20:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique</title>
      <link>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163736#M631554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another slightly more complicated, but can be useful if CrossTable on the whole thing is a concern can be this:&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 RowNo() as Key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeMinString([Field 1], [Field 2], [Field 3]) &amp;amp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeMinString(RangeMaxString([Field 1], [Field 2]), RangeMaxString([Field 3], [Field 2]), RangeMaxString([Field 1], [Field 3])) &amp;amp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeMaxString([Field 1], [Field 2], [Field 3]) as ConcatField&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field 1, Field 2, Field 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, B, C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, A, C&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, C&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;Expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count(DISTINCT &lt;STRONG style="font-size: 13.3333px;"&gt;ConcatField&lt;/STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/133216_Capture.PNG" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 20:22:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-unique/m-p/1163736#M631554</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-01T20:22:47Z</dc:date>
    </item>
  </channel>
</rss>

