2 Replies Latest reply: Sep 19, 2012 6:44 AM by Pedro Burgo RSS

    AGGR function

      I have data in a table :

       

       

      Client_IDIN/OUTISINdatePriceQTY
      1I619-Sep-1210300
      1I719-Sep-1211250
      1O719-Sep-1211100
      1O619-Sep-1210250
      2I719-Sep-1211100
      2O719-Sep-121150
      2I819-Sep-129500

       

       

       

      I have an issue where im trying to use the aggr function. I would like data output to be in the following form:

       

       

      Client IDValue
      12150
      25050

       

       

      Value =

      aggr( sum( if(      sum(

                                    if  (IN/OUT='O' , -QTY, QTY)

                                    )>'0' ,

       

      Price * sum(if(IN/OUT='O',- QTY, QTY ) )

                      )   )

      ,ISIN)  

       

      So for ClIENT_ID=1 the value would be 150 * 1+ 50 *10 =2150

       

       

      But somehow the above function isnt working in a straight table.

       

       

      Regards

       

      Faisal