0 Replies Latest reply: Dec 4, 2014 6:14 AM by Cartonagem Jauense RSS

    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!