<?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: counting distinct based on 2 fields? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323034#M1189404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, forget my question concerning the bar graph, I was really thinking that there might be a new extension &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/silly.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think my expression should be correct if you want a distinct count, taken the dimensions correctly into account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression of Sridhar should actually be changed to &lt;/P&gt;&lt;P&gt;=Sum(Aggr( Count(Distinct CandID),Date,CandID)) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to be equivalent. Otherwise you would get different (in normal use IMHO "wrong" results) if you use a CandID dimension in your graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, I think my expression is shorter &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Aug 2011 19:59:17 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2011-08-02T19:59:17Z</dc:date>
    <item>
      <title>counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323026#M1189396</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;I am facing a problem in counting distinct numbers as I don't know the exact syntax. I have data that looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CandID&amp;nbsp; Date&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/10&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/10&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/10&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/10&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/6/10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So as you can see candid is repeating for the same date. I want to use an expression, that could count distinct Candid , but if a candid is repeated 3 time (as in the above case) on a single date, it should count it as one. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, it should count 2 candid for the date 2/6/10 in the above example. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so something like count (distinct CandID further based on distinct date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks. any repleis would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 18:15:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323026#M1189396</guid>
      <dc:creator />
      <dc:date>2011-08-01T18:15:22Z</dc:date>
    </item>
    <item>
      <title>counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323027#M1189397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible that in your example CandID 1 appears also on a date different than 2/6/10?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, a &lt;/P&gt;&lt;P&gt;count (distinct CandID)&lt;/P&gt;&lt;P&gt;should be enough, shouldn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there are multiple dates to distinguish, you could use a concatenation between CandID &amp;amp; Date and count distinct that one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 18:51:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323027#M1189397</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-08-01T18:51:25Z</dc:date>
    </item>
    <item>
      <title>counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323028#M1189398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes there are multiple dates on which same CandID is present, thats what the problem was. Can you write the syntax for how to concatenate CandId and date and count distinct that??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks so much for your reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 19:02:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323028#M1189398</guid>
      <dc:creator />
      <dc:date>2011-08-01T19:02:06Z</dc:date>
    </item>
    <item>
      <title>counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323029#M1189399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nothing special,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try &lt;/P&gt;&lt;P&gt;=count(distinct CandID&amp;amp;'-'&amp;amp;Date)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 19:11:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323029#M1189399</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-08-01T19:11:56Z</dc:date>
    </item>
    <item>
      <title>counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323030#M1189400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=Aggr(Count(Distinct CandID),Date)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 04:53:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323030#M1189400</guid>
      <dc:creator>rahulgupta</dc:creator>
      <dc:date>2011-08-02T04:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323031#M1189401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Small changes to the Rahul`s code. Rahul`s code will give you an correct value when you use the expression in pivot / Straight table. but it will not give you the value when the same expression is used in text box, gauge chart and certain scenarios. Covering sum with Rahul`s expression will do the job perfectly for you.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Sum(Aggr(Count(Distinct CandID),Date))&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;- Sridhar&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 05:15:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323031#M1189401</guid>
      <dc:creator />
      <dc:date>2011-08-02T05:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323032#M1189402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used all the above expressions you suggested and I am getting different values for each expression. I am creating a simple chart(car graph), which expression among all will give me the right result in this situation??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks all for the help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Yaman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 18:18:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323032#M1189402</guid>
      <dc:creator />
      <dc:date>2011-08-02T18:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323033#M1189403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you looking for a expression within a chart (by the way, what is a car graph?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What dimension(s) do you use?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our Expressions might give different results depending on your dimensions. What is correct is depending what you want to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you explain a bit closer, what your are trying to achieve with that expression (e.g. count all IDs disregarding the charts dimension, if necessary)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be good if you could post a small sample app here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 19:18:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323033#M1189403</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-08-02T19:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: counting distinct based on 2 fields?</title>
      <link>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323034#M1189404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, forget my question concerning the bar graph, I was really thinking that there might be a new extension &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/silly.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think my expression should be correct if you want a distinct count, taken the dimensions correctly into account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression of Sridhar should actually be changed to &lt;/P&gt;&lt;P&gt;=Sum(Aggr( Count(Distinct CandID),Date,CandID)) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to be equivalent. Otherwise you would get different (in normal use IMHO "wrong" results) if you use a CandID dimension in your graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, I think my expression is shorter &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 19:59:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-distinct-based-on-2-fields/m-p/323034#M1189404</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-08-02T19:59:17Z</dc:date>
    </item>
  </channel>
</rss>

