<?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 Re: SUM 2 conditional counts in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282889#M105153</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you have to use the AGGR function, if you use two aggregation functions like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Aggr(Count(if(category='x', item)),Dimension))+ Sum(Aggr(Count(if(category='y', item)),Dimension))&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Sum(Aggr(Count(if(category='x' or category='y', item)),Dimension &lt;/P&gt;&lt;P&gt;with more performance I would recommend this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Aggr(Sum(if(category='x' or category='y', 1,0)),Dimension))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension can be more than one: Dim1,Dim2,Dim3,...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 May 2011 08:57:06 GMT</pubDate>
    <dc:creator>brenner_martina</dc:creator>
    <dc:date>2011-05-09T08:57:06Z</dc:date>
    <item>
      <title>SUM 2 conditional counts</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282888#M105152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I´m trying to sum 2 counts like this, but i get no result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM(Count(if(category='x', item))+ (Count(if(category='y', item))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 08:40:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282888#M105152</guid>
      <dc:creator />
      <dc:date>2011-05-09T08:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: SUM 2 conditional counts</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282889#M105153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you have to use the AGGR function, if you use two aggregation functions like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Aggr(Count(if(category='x', item)),Dimension))+ Sum(Aggr(Count(if(category='y', item)),Dimension))&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Sum(Aggr(Count(if(category='x' or category='y', item)),Dimension &lt;/P&gt;&lt;P&gt;with more performance I would recommend this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Aggr(Sum(if(category='x' or category='y', 1,0)),Dimension))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension can be more than one: Dim1,Dim2,Dim3,...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 08:57:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282889#M105153</guid>
      <dc:creator>brenner_martina</dc:creator>
      <dc:date>2011-05-09T08:57:06Z</dc:date>
    </item>
    <item>
      <title>SUM 2 conditional counts</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282890#M105154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Polschou,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why you use sum?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can get the result direct with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count(if(category='x' or category='y', item))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and try to use set anylasis as following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count({&amp;lt;category={'x','y'}&amp;gt;} item)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this help you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 09:00:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282890#M105154</guid>
      <dc:creator />
      <dc:date>2011-05-09T09:00:34Z</dc:date>
    </item>
    <item>
      <title>SUM 2 conditional counts</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282891#M105155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Martina&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried somthing else and it seems to work for me - I use this to add the 2 conditions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COUNT(IF(categori='x' OR categori='y',item))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 09:02:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282891#M105155</guid>
      <dc:creator />
      <dc:date>2011-05-09T09:02:33Z</dc:date>
    </item>
    <item>
      <title>SUM 2 conditional counts</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282892#M105156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Mohammed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want to add another condition like this &lt;/P&gt;&lt;P&gt;COUNT(IF(categori='x' OR categori='y' AND YEAR='2011',item)) - but this gives a wrong result - I cant attach a&lt;/P&gt;&lt;P&gt;QW file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 08:56:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282892#M105156</guid>
      <dc:creator />
      <dc:date>2011-05-10T08:56:36Z</dc:date>
    </item>
    <item>
      <title>SUM 2 conditional counts</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282893#M105157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/polschou" id="jive-25863382788171826538" style="font-size: 12px; color: #007fc0; text-decoration: underline; font-weight: bold;"&gt;polschou&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think it should be like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COUNT(IF(&lt;STRONG&gt;(&lt;/STRONG&gt;categori='x' OR categori='y' &lt;STRONG style="text-decoration: underline;"&gt;)&lt;/STRONG&gt; AND YEAR='2011',item))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count({&amp;lt;categori={'x','y'},YEAR='2011'&amp;gt;} item)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the diffrent is ( ) between Category and Year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 09:05:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-2-conditional-counts/m-p/282893#M105157</guid>
      <dc:creator />
      <dc:date>2011-05-10T09:05:34Z</dc:date>
    </item>
  </channel>
</rss>

