5 Replies Latest reply: Mar 15, 2012 9:44 AM by Mathias Vanden Auweele RSS

    Expression with if() and aggr()

    Mathias Vanden Auweele

      Dear all,

       

      I have a very weird problem with a a chart expression. The simplified problem: I have a table with a dimension going from 1 to 10. My expression needs to be calculated depending on the dimension. So I write as expression (with DIM the dimension):

       

      if (DIM=1, valueForDim1,

      if (DIM=2, valueForDim2,

      if (DIM=3, valueForDim3, [...]

       

      Normally this doesn't give me any problems. However this time I need to use the advanced aggregation function (with AggrDim the aggregation dimension and AggrExpr the aggregation expression):

       

      if (DIM=1, avg(aggr(AggrExpr1,AggrDim)),

      if (DIM=2, avg(aggr(AggrExpr2,AggrDim)),

      if (DIM=3, avg(aggr(AggrExpr3,AggrDim)), [...]

       

      Now I only get a result for my first dimension! The other dimensions are not calculated! When I delete the if(DIM=1...) then I only get a result for the second dimension (and so on). The aggregations work like a charm when I use them outside the if() clauses.

       

      Does anyone know how to fix this? Is this a bug? Thanks!