Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
paolocamerini
Partner - Contributor III
Partner - Contributor III

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

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

7 Replies
tresB
Champion III
Champion III

Try:

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


Edit: Corrected -removed '$'

vinieme12
Champion III
Champion III

can you post a sample application and expected output?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
paolocamerini
Partner - Contributor III
Partner - Contributor III
Author

Still not working, thank you though

paolocamerini
Partner - Contributor III
Partner - Contributor III
Author

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

tresB
Champion III
Champion III

Capture.JPG

woshua5550
Creator III
Creator III

Try like this

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

PFA

paolocamerini
Partner - Contributor III
Partner - Contributor III
Author

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