<?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: aggregate counts from different if conditions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409571#M1165027</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;aah... got to use the advanced editor to attach files &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Sep 2012 19:38:00 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-09-14T19:38:00Z</dc:date>
    <item>
      <title>aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409566#M1165022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13476440983565221" jivemacro_uid="_13476440983565221"&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i have a complex set of conditions depending on values of the Fact table, each of which might result in a different figure (e.g. 3, 4 and 5 for each of the following).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(source1='1',(count( {$&amp;lt; STATUS = {'A', 'B'}&amp;gt;} DISTINCT ITEM_ID)),&lt;/P&gt;&lt;P&gt;//Next line for counting the items with Status = C and any Resolution except F or G.&lt;/P&gt;&lt;P&gt; if(source='1',(count( {$&amp;lt; STATUS = {'C'},RESOLUTION= {"*"} -{'F', 'G'}&amp;gt;} DISTINCT ITEM_ID)),&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(source='2',(count( {$&amp;lt; STATUS = {'A', 'D'}&amp;gt;} DISTINCT NS_BUG_ID)))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking for the aggregate of those three (or two, or one) resulting figures, or zero if none of the conditions are met.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having sum(aggr(&amp;nbsp; in front of everything above doesn't seem to work. I guess i'm using something wrongly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas are welcome.&lt;BR /&gt; &lt;BR /&gt; Thanks!&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 17:36:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409566#M1165022</guid>
      <dc:creator />
      <dc:date>2012-09-14T17:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409567#M1165023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;I'm looking for the aggregate of those three&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What is your dimension to aggregate ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 18:34:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409567#M1165023</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-14T18:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409568#M1165024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13476493444827476" jivemacro_uid="_13476493444827476"&gt;&lt;P&gt;Thanks for your quick hand!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm just counting distinct items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can make an example app.if that helps...&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 19:02:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409568#M1165024</guid>
      <dc:creator />
      <dc:date>2012-09-14T19:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409569#M1165025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Btw, i noticed a small typo in my example above (source1 instead of source), but that's not what's breaking my code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 19:11:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409569#M1165025</guid>
      <dc:creator />
      <dc:date>2012-09-14T19:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409570#M1165026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found another typo (NS_bug istead of ITEM) that i fixed too, but doesn't solve it. Don't know how to attach the sample_A.qvw file i prepared...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 19:35:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409570#M1165026</guid>
      <dc:creator />
      <dc:date>2012-09-14T19:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409571#M1165027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;aah... got to use the advanced editor to attach files &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 19:38:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409571#M1165027</guid>
      <dc:creator />
      <dc:date>2012-09-14T19:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409572#M1165028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, try to enclose your expression with something like this:&lt;/P&gt;&lt;P&gt;=Sum(aggr(...put your complex expression here..., status))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I see the problem with your if expression:&lt;/P&gt;&lt;P&gt;=if(status='1', ...this works when status=1...,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(status='1', &lt;STRONG&gt;...this never works...&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(status='2', ...this works when status=2)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to understand how the if works and how you use it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 19:59:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409572#M1165028</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-14T19:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: aggregate counts from different if conditions</title>
      <link>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409573#M1165029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1347657977033900" jivemacro_uid="_1347657977033900"&gt;&lt;P&gt;Thanks! You're right; using IF statements overcomplicates a simple sum that can also be done like this (now it works!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&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; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;STATUS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'A', 'B'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;source&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {'1'}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ITEM_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))+&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//Next line for counting the items with Status = C and any Resolution except F or G.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;STATUS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'C'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;source&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {'1'},&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;RESOLUTION&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"*"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} -{'F', 'G'}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ITEM_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))+&lt;BR /&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;STATUS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'A', 'D'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;source&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {'2'}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ITEM_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2012 21:26:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggregate-counts-from-different-if-conditions/m-p/409573#M1165029</guid>
      <dc:creator />
      <dc:date>2012-09-14T21:26:54Z</dc:date>
    </item>
  </channel>
</rss>

