<?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 How to count distinct with an intersection within the same field? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822351#M289923</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table&lt;/P&gt;&lt;P&gt;User 1 opens document A&lt;/P&gt;&lt;P&gt;User 1 opens documet B&lt;/P&gt;&lt;P&gt;User 2 opens document C&lt;/P&gt;&lt;P&gt;User 3 opens document B&lt;/P&gt;&lt;P&gt;User 4 opens B&lt;/P&gt;&lt;P&gt;User 4 opens C&lt;/P&gt;&lt;P&gt;User 5 opens A&lt;/P&gt;&lt;P&gt;User 5 opens B&lt;/P&gt;&lt;P&gt;User 5 opens C&lt;/P&gt;&lt;P&gt;User 6 opens A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can do Count with set analysis how many opened any document.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; {&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Document&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'A'}&amp;gt;} &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;User&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp; That's 3 in this example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can I do something like this&lt;/STRONG&gt;: Count users that have opened BOTH A and B. &lt;STRONG&gt;2 in this example (User 1 and User 5)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Because &lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; {&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Document&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'A','B'}&amp;gt;} &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;User&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) gives me users that have opened Either A or B. 5 in this example (1,5, + 3,4,6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Any help will be much apreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Mar 2015 20:09:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-03-17T20:09:58Z</dc:date>
    <item>
      <title>How to count distinct with an intersection within the same field?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822351#M289923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table&lt;/P&gt;&lt;P&gt;User 1 opens document A&lt;/P&gt;&lt;P&gt;User 1 opens documet B&lt;/P&gt;&lt;P&gt;User 2 opens document C&lt;/P&gt;&lt;P&gt;User 3 opens document B&lt;/P&gt;&lt;P&gt;User 4 opens B&lt;/P&gt;&lt;P&gt;User 4 opens C&lt;/P&gt;&lt;P&gt;User 5 opens A&lt;/P&gt;&lt;P&gt;User 5 opens B&lt;/P&gt;&lt;P&gt;User 5 opens C&lt;/P&gt;&lt;P&gt;User 6 opens A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can do Count with set analysis how many opened any document.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; {&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Document&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'A'}&amp;gt;} &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;User&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp; That's 3 in this example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can I do something like this&lt;/STRONG&gt;: Count users that have opened BOTH A and B. &lt;STRONG&gt;2 in this example (User 1 and User 5)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Because &lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; {&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Document&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'A','B'}&amp;gt;} &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;User&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) gives me users that have opened Either A or B. 5 in this example (1,5, + 3,4,6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Any help will be much apreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 20:09:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822351#M289923</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T20:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct with an intersection within the same field?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822352#M289924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in a text box?&lt;/P&gt;&lt;P&gt;=sum(if(aggr(count({$ &amp;lt;doc={B,A}&amp;gt;} distinct doc), user)=2,1))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 20:19:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822352#M289924</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-03-17T20:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct with an intersection within the same field?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822353#M289925</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;=Count({&amp;lt;Document={'A'}&amp;gt;} DISTINCT User)+ Count({&amp;lt;Document={'B'}&amp;gt;} DISTINCT User)-&amp;nbsp; Count({&amp;lt;Document={'A','B'}&amp;gt;} DISTINCT User) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 20:30:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822353#M289925</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T20:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct with an intersection within the same field?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822354#M289926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=count({&amp;lt;User = p({&amp;lt;Document = {A}&amp;gt;}) * p({&amp;lt;Document = {B}&amp;gt;}) &amp;gt;} distinct User)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 20:37:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822354#M289926</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-03-17T20:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to count distinct with an intersection within the same field?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822355#M289927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now my dilemma is, How can I mark the 3 as correct answers?!!&lt;/P&gt;&lt;P&gt;Thanks Massimo, Thanks QlikRajan, Thanks Manish!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everyone else, this 3 worked:&lt;/P&gt;&lt;P&gt;=sum(if(aggr(count({$ &amp;lt;Document={'B','A'}&amp;gt;} distinct Document), user)=2,1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Count({&amp;lt;Document={'A'}&amp;gt;} DISTINCT User)+ Count({&amp;lt;Document={'B'}&amp;gt;} DISTINCT User)-&amp;nbsp; Count({&amp;lt;Document={'A','B'}&amp;gt;} DISTINCT User)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;User = p({&amp;lt;Document = {'A'}&amp;gt;}) * p({&amp;lt;Document = {'B'}&amp;gt;}) &amp;gt;} distinct User)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess the second one might be easier on CPU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again guys.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 22:20:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-count-distinct-with-an-intersection-within-the-same-field/m-p/822355#M289927</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T22:20:20Z</dc:date>
    </item>
  </channel>
</rss>

