<?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 Problem with aggr() function with if. in Qlik Learning Discussions</title>
    <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Problem-with-aggr-function-with-if/m-p/774007#M1895</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I'm having a Simple Table and on each line has different expressions. It controls what expressions goes to each line with a code:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Code_Dim_Fat='A001', &amp;lt;EXPRESSION_1&amp;gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; &lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Code_Dim_Fat='A002', &amp;lt;EXPRESSION_2&amp;gt;, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ... ))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far, I have never used an expression in this table that contains an aggr() function. Now I need it, but doesn't work!!!!&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Cod_Dim_Fat='A001',num(sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}&amp;gt;} Metas_Fat_Reais) / ...), MesAno)),'#.##0,00'),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Cod_Dim_Fat='A002',num(sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}&amp;gt;} Metas_Fat_Qt) / ..., MesAno))&lt;SPAN style="font-family: 'courier new', courier;"&gt;,'#.##0,00'),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second expression ALWAYS return zero. I've tried to eliminate IF like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;num(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}, &lt;SPAN style="font-family: 'courier new', courier;"&gt;Cod_Dim_Fat = {'A001'}&lt;/SPAN&gt;&amp;gt;} Metas_Fat_Reais) / ...), MesAno))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;+&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}&lt;SPAN style="font-family: 'courier new', courier;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Cod_Dim_Fat = {'A002'}&lt;/SPAN&gt;&amp;gt;} Metas_Fat_Qt) / ..., MesAno))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;,'#.##0,00')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But still doesn't work!!&lt;/P&gt;&lt;P&gt;Why does the AGGR() not work like that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Dec 2014 11:14:21 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-12-04T11:14:21Z</dc:date>
    <item>
      <title>Problem with aggr() function with if.</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Problem-with-aggr-function-with-if/m-p/774007#M1895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I'm having a Simple Table and on each line has different expressions. It controls what expressions goes to each line with a code:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Code_Dim_Fat='A001', &amp;lt;EXPRESSION_1&amp;gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; &lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Code_Dim_Fat='A002', &amp;lt;EXPRESSION_2&amp;gt;, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ... ))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far, I have never used an expression in this table that contains an aggr() function. Now I need it, but doesn't work!!!!&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Cod_Dim_Fat='A001',num(sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}&amp;gt;} Metas_Fat_Reais) / ...), MesAno)),'#.##0,00'),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(Cod_Dim_Fat='A002',num(sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}&amp;gt;} Metas_Fat_Qt) / ..., MesAno))&lt;SPAN style="font-family: 'courier new', courier;"&gt;,'#.##0,00'),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second expression ALWAYS return zero. I've tried to eliminate IF like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;num(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}, &lt;SPAN style="font-family: 'courier new', courier;"&gt;Cod_Dim_Fat = {'A001'}&lt;/SPAN&gt;&amp;gt;} Metas_Fat_Reais) / ...), MesAno))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;+&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;sum(aggr((sum({&amp;lt;%EmpresaID = {'J'}&lt;SPAN style="font-family: 'courier new', courier;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Cod_Dim_Fat = {'A002'}&lt;/SPAN&gt;&amp;gt;} Metas_Fat_Qt) / ..., MesAno))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;,'#.##0,00')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But still doesn't work!!&lt;/P&gt;&lt;P&gt;Why does the AGGR() not work like that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 11:14:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Problem-with-aggr-function-with-if/m-p/774007#M1895</guid>
      <dc:creator />
      <dc:date>2014-12-04T11:14:21Z</dc:date>
    </item>
  </channel>
</rss>

