<?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 Using Count with IF expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246006#M1205535</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much. It works perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Mar 2010 19:57:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-03-02T19:57:54Z</dc:date>
    <item>
      <title>Using Count with IF expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246004#M1205533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why is it that the expression below return the right value (the ProjectID if true and Null if false):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (Sum(ProjectTime) = 0, ProjectID)&lt;/P&gt;&lt;P&gt;But this expression return everything Null:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count (Distinct if (Sum(ProjectTime) = 0, ProjectID))&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Mar 2010 19:06:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246004#M1205533</guid>
      <dc:creator />
      <dc:date>2010-03-02T19:06:32Z</dc:date>
    </item>
    <item>
      <title>Using Count with IF expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246005#M1205534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm guessing that when you say the first expression works, you mean that it works in a chart with a dimension of ProjectID? And when you say the second expression returns everything null, you mean in a text box or something like that?&lt;/P&gt;&lt;P&gt;If so, the first expression works because the chart forces it to only look at one ProjectID at a time. And the second expression doesn't work because it looks at all ProjectIDs at the same time, not one at a time. So it sums the ProjectTime across ALL ProjectIDs, which probably isn't 0, so it returns null.&lt;/P&gt;&lt;P&gt;If I'm guessing what you're after correctly, you need to tell QlikView to evaluate your if() expression for one ProjectID at a time instead of all at once, just like you do in the chart I'm guessing you have. You do that with an aggr(...,ProjectID). Like this, I think:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;count(distinct aggr(if(sum(ProjectTime)=0,ProjectID),ProjectID))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Mar 2010 19:32:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246005#M1205534</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-02T19:32:33Z</dc:date>
    </item>
    <item>
      <title>Using Count with IF expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246006#M1205535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much. It works perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Mar 2010 19:57:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246006#M1205535</guid>
      <dc:creator />
      <dc:date>2010-03-02T19:57:54Z</dc:date>
    </item>
    <item>
      <title>Using Count with IF expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246007#M1205536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I have a problem similar but I can't not solve it with your solution.&lt;/P&gt;&lt;P&gt;My dimension is a category of product (for which I put a target)&lt;/P&gt;&lt;P&gt;Count(distinct if ( InvoicedQty&amp;gt;Target and YYYYMM &amp;lt;= '200901' and YYYYMMlis &amp;gt;200801 , Customer))&lt;/P&gt;&lt;P&gt;but I want sum of InvoiceQTY&lt;/P&gt;&lt;P&gt;I tried:&lt;/P&gt;&lt;P&gt;Count(distinct aggr( if SUM(InvoicedQty) &amp;gt;Target and YYYYMM &amp;lt;= '200901' and YYYYMMlis &amp;gt;200801 , Customer),CATEGORY)&lt;/P&gt;&lt;P&gt;but it returns nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jun 2010 18:00:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246007#M1205536</guid>
      <dc:creator />
      <dc:date>2010-06-25T18:00:41Z</dc:date>
    </item>
    <item>
      <title>Using Count with IF expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246008#M1205537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found it :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if( aggr( sum(if (YYYYMM &amp;lt;= '200901' and YYYYMM &amp;gt;200801,InvoicedQty)),CATEGORY,Customer)&amp;gt;=Target,1,0))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jun 2010 16:46:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Count-with-IF-expression/m-p/246008#M1205537</guid>
      <dc:creator />
      <dc:date>2010-06-27T16:46:40Z</dc:date>
    </item>
  </channel>
</rss>

