<?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 and syntax in an expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557282#M208057</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please kindly assist me with the proper use of the "and" logical function in an expression. For example, I have tried using it as follows: Count(If(Year='2013'and [Estimate-Kg]&amp;gt;='0' and [Sales-Kg]&amp;lt;='1',[Grower No.],0)), this doesn't quite work. Is there also some sort of a "syntax" guide available?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Herbiec 09&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Dec 2013 08:07:18 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-12-11T08:07:18Z</dc:date>
    <item>
      <title>and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557282#M208057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please kindly assist me with the proper use of the "and" logical function in an expression. For example, I have tried using it as follows: Count(If(Year='2013'and [Estimate-Kg]&amp;gt;='0' and [Sales-Kg]&amp;lt;='1',[Grower No.],0)), this doesn't quite work. Is there also some sort of a "syntax" guide available?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Herbiec 09&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 08:07:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557282#M208057</guid>
      <dc:creator />
      <dc:date>2013-12-11T08:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557283#M208058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please rewrite the expression as,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Year='2013'and [Estimate-Kg]&amp;gt;='0' and [Sales-Kg]&amp;lt;='1',Count([Grower No.]),0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 08:22:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557283#M208058</guid>
      <dc:creator />
      <dc:date>2013-12-11T08:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557284#M208059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your expression will return a number different from what you want. You use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;Count(If(&lt;SPAN style="color: #800000;"&gt;Year&lt;/SPAN&gt;='2013'and &lt;SPAN style="color: #800000;"&gt;[Estimate-Kg]&lt;/SPAN&gt;&amp;gt;='0' and &lt;SPAN style="color: #800000;"&gt;[Sales-Kg]&lt;/SPAN&gt;&amp;lt;='1',&lt;SPAN style="color: #800000;"&gt;[Grower No.]&lt;/SPAN&gt;,0))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have four fields inside the aggregation, fields that probably reside in different tables. The logic is that QlikView first creates the join between these tables, and then performs the count on this temporary table. I.e. the number of rows will be much larger than you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prabhu's expression will work - but only if "Year", "Estimate-Kg" and "Sales-Kg" exist as dimensions in the graph. Otherwise these will be evaluated to NULL. See more on &lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, the proper way to do this, is to use Set Analysis:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;Count({$&amp;lt;&lt;SPAN style="color: #800000;"&gt;Year&lt;/SPAN&gt;={'2013'}, &lt;SPAN style="color: #800000;"&gt;[Estimate-Kg]&lt;/SPAN&gt;={"&amp;gt;=0"}, &lt;SPAN style="color: #800000;"&gt;[Sales-Kg]&lt;/SPAN&gt;={"&amp;lt;=1"}&amp;gt;} &lt;SPAN style="color: #800000;"&gt;[Grower No.] &lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 08:35:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557284#M208059</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-12-11T08:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557285#M208060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Prabhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately it's returning a zero count. I have manually checked the data, and I have instances where I have estimated kg's, but no actual sales, i.e. sales-kg = 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Herbiec09&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 08:41:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557285#M208060</guid>
      <dc:creator />
      <dc:date>2013-12-11T08:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557286#M208061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As said by Henric .. Unless you have "Year", "Estimate-Kg" and "Sales-Kg as dimensions the above expression wont work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is better to use Set Analysis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 08:45:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557286#M208061</guid>
      <dc:creator />
      <dc:date>2013-12-11T08:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557287#M208062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Spot On, many thanks Henric, this works perfectly. Really appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;H&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 09:21:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557287#M208062</guid>
      <dc:creator />
      <dc:date>2013-12-11T09:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: and syntax in an expression</title>
      <link>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557288#M208063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks Prabhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes u are right, that has finally worked. Appreciate you taking the time to look at it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;H&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 09:22:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/and-syntax-in-an-expression/m-p/557288#M208063</guid>
      <dc:creator />
      <dc:date>2013-12-11T09:22:25Z</dc:date>
    </item>
  </channel>
</rss>

