<?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 COUNT expression help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201122#M59371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Does Count() include NULLS? If no I have the following problem.&lt;/P&gt;&lt;P&gt;I want to Count all my clients where the total portfolio is &amp;lt;&amp;gt;0 for a selected YearMonth. I've used the following expression&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF&lt;/STRONG&gt;(Sum ({$&amp;lt;[YearMonth] = {&lt;I&gt;$(SelectedYearMonth)&lt;/I&gt;}&amp;gt;} Value) &amp;lt;&amp;gt; 0, COUNT(DISTINCT(Client)), NULL() )&lt;/P&gt;&lt;P&gt;To test I've created a chart with dimension 'Client' and the expression above to count. So the Count column displays '1' or '-' per client depending on the result of the expression.&lt;/P&gt;&lt;P&gt;My problem is that the Total Count seems to be including the '-' in Total so it is essentially giving me a SUM of the number of rows. I've used 'Expression Total' in the Total Mode.&lt;/P&gt;&lt;P&gt;Is there a way to ignore the NULL in when using COUNT?&lt;/P&gt;&lt;P&gt;All help is appreciated&lt;/P&gt;&lt;P&gt;G&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Feb 2011 12:58:38 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-02-04T12:58:38Z</dc:date>
    <item>
      <title>COUNT expression help</title>
      <link>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201122#M59371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Does Count() include NULLS? If no I have the following problem.&lt;/P&gt;&lt;P&gt;I want to Count all my clients where the total portfolio is &amp;lt;&amp;gt;0 for a selected YearMonth. I've used the following expression&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF&lt;/STRONG&gt;(Sum ({$&amp;lt;[YearMonth] = {&lt;I&gt;$(SelectedYearMonth)&lt;/I&gt;}&amp;gt;} Value) &amp;lt;&amp;gt; 0, COUNT(DISTINCT(Client)), NULL() )&lt;/P&gt;&lt;P&gt;To test I've created a chart with dimension 'Client' and the expression above to count. So the Count column displays '1' or '-' per client depending on the result of the expression.&lt;/P&gt;&lt;P&gt;My problem is that the Total Count seems to be including the '-' in Total so it is essentially giving me a SUM of the number of rows. I've used 'Expression Total' in the Total Mode.&lt;/P&gt;&lt;P&gt;Is there a way to ignore the NULL in when using COUNT?&lt;/P&gt;&lt;P&gt;All help is appreciated&lt;/P&gt;&lt;P&gt;G&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Feb 2011 12:58:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201122#M59371</guid>
      <dc:creator />
      <dc:date>2011-02-04T12:58:38Z</dc:date>
    </item>
    <item>
      <title>COUNT expression help</title>
      <link>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201123#M59372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Count does not include nulls. Your problem is that you're counting Clients, and this does not take into account your sum expression. You need to use advanced aggregation for this (aggr). I'm assuming you know your set analysis is correct, so here is what the aggr would look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;sum(&lt;BR /&gt; aggr(nodistinct&lt;BR /&gt; if(sum({&amp;lt;[Year Month]={$(SelectedYearMonth)}&amp;gt;} Value) &amp;lt;&amp;gt;0,1)&lt;BR /&gt; ,Client&lt;BR /&gt; )&lt;BR /&gt;)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The aggr essentially creates flags of 1 for each client where sum(value)&amp;lt;&amp;gt;0 and the outer sum adds the total of these flags.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Feb 2011 18:35:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201123#M59372</guid>
      <dc:creator>vgutkovsky</dc:creator>
      <dc:date>2011-02-04T18:35:21Z</dc:date>
    </item>
    <item>
      <title>COUNT expression help</title>
      <link>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201124#M59373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the code and explanation Vlad, you've helped a great deal!&lt;/P&gt;&lt;P&gt;G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 15:40:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/COUNT-expression-help/m-p/201124#M59373</guid>
      <dc:creator />
      <dc:date>2011-02-08T15:40:12Z</dc:date>
    </item>
  </channel>
</rss>

