<?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 Getting count based on an expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Getting-count-based-on-an-expression/m-p/531933#M482751</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the below expression I am trying to find the count of distinct products for which % Change in Cost is &amp;gt;=0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;Product={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"=if((Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost) - &lt;BR /&gt;&lt;BR /&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change))=0,0,&lt;BR /&gt;&lt;BR /&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change)/&lt;BR /&gt;&lt;BR /&gt;(Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost) - &lt;BR /&gt;&lt;BR /&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change)))&amp;gt;=0"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;} DISTINCT Product) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;But this expression is not returning a correct value if denominator is zero ie if &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost) - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change)=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 28 Jul 2013 19:40:34 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-07-28T19:40:34Z</dc:date>
    <item>
      <title>Getting count based on an expression</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-count-based-on-an-expression/m-p/531933#M482751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the below expression I am trying to find the count of distinct products for which % Change in Cost is &amp;gt;=0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;Product={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"=if((Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost) - &lt;BR /&gt;&lt;BR /&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change))=0,0,&lt;BR /&gt;&lt;BR /&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change)/&lt;BR /&gt;&lt;BR /&gt;(Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost) - &lt;BR /&gt;&lt;BR /&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change)))&amp;gt;=0"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;} DISTINCT Product) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;But this expression is not returning a correct value if denominator is zero ie if &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost) - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {1&amp;lt;Product=p(Product)&amp;gt;} Cost_Change)=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jul 2013 19:40:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-count-based-on-an-expression/m-p/531933#M482751</guid>
      <dc:creator />
      <dc:date>2013-07-28T19:40:34Z</dc:date>
    </item>
  </channel>
</rss>

