Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
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:

num(

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))

,'#.##0,00')


But still doesn't work!!

Why does the AGGR() not work like that?

Thanks in advance!

0 Replies