Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ceciliafujita
Contributor III
Contributor III

try to use aggregation to define my set analysis

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


1 Solution

Accepted Solutions
swuehl
MVP
MVP

I am not sure how your alternate states come into play, but to start simple, let's assume you are working in default state on a sample data set like shown above.

=Sum({<chave = p(), cdProc>}value)

On selecting cdProc p1, the expression should return 80 (sum value of all chave that are linked to p1, ignoring the selection on p1).

=Sum({<chave = p()*{"=Sum({1} value)>30"}, cdProc>}value)

This should return 60, sum value of all chave that are linked to p1, ignoring the selection on p1, but now filter the chave that show a total sum value above 30 (using intersection operator *).

View solution in original post

2 Replies
swuehl
MVP
MVP

I am not sure how your alternate states come into play, but to start simple, let's assume you are working in default state on a sample data set like shown above.

=Sum({<chave = p(), cdProc>}value)

On selecting cdProc p1, the expression should return 80 (sum value of all chave that are linked to p1, ignoring the selection on p1).

=Sum({<chave = p()*{"=Sum({1} value)>30"}, cdProc>}value)

This should return 60, sum value of all chave that are linked to p1, ignoring the selection on p1, but now filter the chave that show a total sum value above 30 (using intersection operator *).

ceciliafujita
Contributor III
Contributor III
Author

Stefan, u r a genius!

Everything works wonderfully here thanks to you!