<?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 IF in an expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738571#M1058510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp; I want to right an expression which basically say, if the field 'location' equals 'Halifax' count the number of instances. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What formula do I need to write?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Oct 2014 12:07:27 GMT</pubDate>
    <dc:creator>bazzaonline</dc:creator>
    <dc:date>2014-10-16T12:07:27Z</dc:date>
    <item>
      <title>Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738571#M1058510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp; I want to right an expression which basically say, if the field 'location' equals 'Halifax' count the number of instances. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What formula do I need to write?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 12:07:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738571#M1058510</guid>
      <dc:creator>bazzaonline</dc:creator>
      <dc:date>2014-10-16T12:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738572#M1058511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use Set Analysis&lt;/P&gt;&lt;P&gt;=count({&amp;lt;location={'Halifax'}&amp;gt; FIELDTOCOUNT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on the fieldtocount and your requirements you may or may not need to use distinct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 12:10:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738572#M1058511</guid>
      <dc:creator>simondachstr</dc:creator>
      <dc:date>2014-10-16T12:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738573#M1058512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count({&amp;lt;location={'Halifax'}&amp;gt;} fieldtocount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The field to count could be the location field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also create a field for counting set to 1 in your table ie:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 as location_count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use the following (I think there are performance benefits to using sum):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;location={'Halifax'}&amp;gt;} location_count)&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;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.techstuffybooks.com"&gt;http://www.techstuffybooks.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 12:13:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738573#M1058512</guid>
      <dc:creator>markodonovan</dc:creator>
      <dc:date>2014-10-16T12:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738574#M1058513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="1.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/69118_1.PNG.png" /&gt;&lt;/P&gt;&lt;P&gt;Yours,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 17:11:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738574#M1058513</guid>
      <dc:creator />
      <dc:date>2014-10-16T17:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738575#M1058514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THIS is bad practice William - Have a look at the QlikView Reference Manual 11 Appendix C.4 for more information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 21:41:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738575#M1058514</guid>
      <dc:creator>simondachstr</dc:creator>
      <dc:date>2014-10-16T21:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738576#M1058515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your comment. I looked at the reference manual and I believe it's bad practice because it's expensive to have text comparisons in the condition of if statements. I wasn't aware, so thanks for pointing this out! Is there more to it or is this basically the reason? I just want to make sure I've understood this properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, in light of this discovery, what would be the performance difference between 1. flagging the value 'Halifax' in the script with the number 1 and using the flag field instead in the condition of the if statement &lt;SPAN style="font-size: 13.6000003814697px;"&gt;(like the reference manual suggests), and 2. &lt;/SPAN&gt;using set analysis like you suggested above?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yours,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 22:36:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738576#M1058515</guid>
      <dc:creator />
      <dc:date>2014-10-16T22:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738577#M1058516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These are very good questions Williams and to get an answer one needs to dig deeper into the QlikView calculation engine. The two documents below by Henric summarize very well what's going on in conditional calculations and how the performance is affected:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2014/07/07/performance-of-conditional-aggregations" title="http://community.qlik.com/blogs/qlikviewdesignblog/2014/07/07/performance-of-conditional-aggregations"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2014/07/07/performance-of-conditional-aggregations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2014/05/12/count-or-count-distinct" title="http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/12/count-or-count-distinct"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/12/count-or-count-distinct&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 08:44:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738577#M1058516</guid>
      <dc:creator>simondachstr</dc:creator>
      <dc:date>2014-10-17T08:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count IF in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738578#M1058517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting the links to HIC's articles - very informative indeed. What really stood out to me was knowing that, even though set analysis is by far the best option for large data sets, it may not be so for small ones, because its overhead may be larger than the performance gain. So it's back to the fundamentals: knowing what tool to use and when - as an engineer, I love it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, I'd like to take a step back to ask &lt;A href="https://community.qlik.com/qlik-users/172086"&gt;Paul Barrett&lt;/A&gt; if his question is now answered. Paul, if you can give us an update that would be very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers gentlemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 17:05:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-IF-in-an-expression/m-p/738578#M1058517</guid>
      <dc:creator />
      <dc:date>2014-10-17T17:05:20Z</dc:date>
    </item>
  </channel>
</rss>

