2 Replies Latest reply: Mar 17, 2013 4:06 PM by Thierry Theyskens RSS

    aggr function help

    Thierry Theyskens

      Hello All,


      I made a fomula which is good for an individual item :


      sum(aggr(sum({<TypeDocument={SO,CO}, GL_Class_SO={'FNE'}>} SalesQuantity), ItemNo) * aggr(sum(DirectLaborItem), ItemNo))


      (DirectLaborItem is the direct labor for an individual item)


      When I unselect the item, I have got a result for all the item which is OK as well.

      Now, I'd like to have the result of all my items even if I select one.


      I made this:

      sum(aggr(sum({1<Period=P(Period), TypeDocument={SO,CO},GL_Class_SO={'FNE'}>} TOTAL SalesQuantity), ItemNo) *aggr(sum(DirectLaborItem), ItemNo))


      but the result is false.


      Could you help me?

      Thank a lot in advance


      T T

        • Re: aggr function help
          Stefan Wühl

          It is not trivial to answer your question, not knowing your data model etc. If possible, upload a small sample file, this makes it easier for us to help you.


          If you want to ignore selections in field ItemNo (that's what I understood), I would start with ignoring this field's selection in a set expression in all of your aggregation functions:


          = sum( {<ItemNo= >}

                         aggr(sum({<ItemNo=, TypeDocument={SO,CO}, GL_Class_SO={'FNE'}>} SalesQuantity), ItemNo) *                aggr(sum({<ItemNo=>} DirectLaborItem), ItemNo)



          [And I think this should be equivalent:



          = sum( {<ItemNo= >}


                                   sum({<ItemNo=, TypeDocument={SO,CO}, GL_Class_SO={'FNE'}>} SalesQuantity)*                          sum({<ItemNo= >} DirectLaborItem)

                              , ItemNo)