Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

SIGN UP for Qlik's 15-week Applied Data Analytics using Qlik Sense course. Begins May 9, 2022.
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with aggr() function with if.

Hi there!

I'm having a Simple Table and on each line has different expressions. It controls what expressions goes to each line with a code:

if(Code_Dim_Fat='A001', <EXPRESSION_1>,

if(Code_Dim_Fat='A002', <EXPRESSION_2>,

  ... ))

So far, I have never used an expression in this table that contains an aggr() function. Now I need it, but doesn't work!!!!

if(Cod_Dim_Fat='A001',num(sum(aggr((sum({<%EmpresaID = {'J'}>} Metas_Fat_Reais) / ...), MesAno)),'#.##0,00'),

if(Cod_Dim_Fat='A002',num(sum(aggr((sum({<%EmpresaID = {'J'}>} Metas_Fat_Qt) / ..., MesAno)),'#.##0,00'),


The second expression ALWAYS return zero. I've tried to eliminate IF like this:


sum(aggr((sum({<%EmpresaID = {'J'}, Cod_Dim_Fat = {'A001'}>} Metas_Fat_Reais) / ...), MesAno))


sum(aggr((sum({<%EmpresaID = {'J'}, Cod_Dim_Fat = {'A002'}>} Metas_Fat_Qt) / ..., MesAno))


But still doesn't work!!

Why does the AGGR() not work like that?

Thanks in advance!

0 Replies
Community Browser