2 Replies Latest reply: Mar 7, 2014 4:34 PM by Fernando Augusto Schmitz RSS

    How to use aggr function inside sum expression

      Hi,

       

      I'm facing a problem on an expression. I need to verify if there is only one month selected or not. I have a pivot table and an expression like this one:

       

      If(Sum(Quantity) =0 ,'', // Here I'm sure the dimension will show even there is no Quantity

      Sum(

          If(not Match(Function,'A','=') ,iF(ISNULL(Quantity),0,Quantity),

              If(((Month=1) or ((aggr(Count(distinct Month), Year, LineCode))=1)) and Function='A',Quantity,

                  If((Month=12 or (aggr(Count(distinct Month), Year, LineCode))=1) and Function='=', Quantity,

                      0)

              )

          )

          )

      )

       

       

      I'm not getting the expect result. This (aggr(Count(distinct Month), Year, LineCode)) does not work when used in the above expression but, if I use just it as another expression, the result is OK.

       

      Does anybody can help me?