2 Replies Latest reply: Sep 29, 2017 7:37 AM by Cecília Fujita Abrahão RSS

    try to use aggregation to define my set analysis

    Cecília Fujita Abrahão

      Hello folks,

       

      I wanna know if use aggr to define a set in my set analysis is possible,

      my dream looks like this:

      sum({ [state1] < chave =

      if ( aggr( sum({ [state1] < chave = P({ [state1] <cdProc = $::cdProc>} chave)>} value) , chave) <= $(vLimInf) , chave)>}

      value)


      I got the 'nested aggregation not allowed' error on this:

      sum(

      if ( aggr( sum({ [state1] < chave = P({ [state1] <cdProc = $::cdProc>} chave)>} value) , chave) <= $(vLimInf) ,

      sum({ [state1] < chave = P({ [state1] <cdProc = $::cdProc>} chave)>} value))


       

      I was expectecting the sum of the value of all Chave who has a cdProc under the vLimInf.

      the structure:

      chave,      cdProc,      value

      c1 ,          p1,          10

      c1,          p2,          50

      c2,          p1,          20 

      c3,          p3,          100

      c4,          p2,            30


      if i select cdProc = p1 then my result is 80 (all the chave's values who has p1)


      But i need to insert a limit :/

      For ex, if the chave's sum is <=  then 30, so i have to take of the entire chave,and my result should be 60.


      what i did that not worked fine was:

      sum({ [state1] < chave = P({ [state1] <cdProc = $::cdProc>} chave)>}

      if ( aggr( sum({ [state1] < chave = P({ [state1] <cdProc = $::cdProc>} chave)>} value) , chave) <= $(vLimInf) , value)


      Thanks