Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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?

2 Replies
rustyfishbones
Master II
Master II

Can you share the Application ??

Not applicable
Author

Sure. Thanks.