7 Replies Latest reply: Nov 15, 2017 6:28 AM by Paolo Camerini

# Set Analysis multiple expressions

Hello everyone,

I'm trying to get the correct results for an expression that should:

• return the average of an "x" value
• only for the values of "x" whose average is between 5 and 10

I already tried the following:

• avg({\$<x={'\$(=avg(x))>5'},{'\$(=avg(x))<=10'}>}x)
• avg({\$<x={'\$(=avg(x))>5'}+{'\$(=avg(x))<=10'}>}x)
• avg({\$<x={'\$(=avg(x))>5'},x={'\$(=avg(x))<=10'}>}x)

Can't solve this, hopefully someone has the solution to this.

Thank you

• ###### Re: Set Analysis multiple expressions

Try:

• avg({\$<x={"=avg(x)>5 and avg(x)<=10"}>}x)

Edit: Corrected -removed '\$'

• ###### Re: Set Analysis multiple expressions

Still not working, thank you though

• ###### Re: Set Analysis multiple expressions

can you post a sample application and expected output?

• ###### Re: Set Analysis multiple expressions

LOAD * INLINE [

Data, Cod, X, Amount

14/11/2017, 000001, 3, 1000

14/11/2017, 000002, 6, 5000

14/11/2017, 000003, 7, 8000

14/11/2017, 000004, 2, 750

15/11/2017, 000001, 3, 1200

15/11/2017, 000002, 6, 6000

15/11/2017, 000003, 7, 7500

15/11/2017, 000004, 2, 1000

];

What I'm trying to get is a table with the sum of "Amount" for each Cod whose avg(X) is between 5 and 10

Cod | AvgX | AmountSum

000002 | 6 | 11.000

000003 | 7 | 15.500

• ###### Re: Set Analysis multiple expressions

Yes, seems like the expansion sign \$ was the culprit. Thank you!

• ###### Re: Set Analysis multiple expressions

Try like this

Sum({<Cod={"=Avg(X)>=5 and Avg(X)<=10"}>}Amount)

PFA