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: 
Not applicable

Dynamic Aggregation

Hey guys:

based on user input I want to compute an average over a specific field:

Set vMenu = GetFieldSelections([Menu Item]); (will return Sales or Revenue or Profit..... and so on)

expression: =avg($(vMenu))

For some reason this does not work, even while $(vMenu) will return Sales

and avg(Sales) will also return a valid number.

Any ideas what might be happening?

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Put '=' in variable definition. See attached.

View solution in original post

9 Replies
MK_QSL
MVP
MVP

Try

expression: =avg($(=vMenu))

Not applicable
Author

Nope, unfortunately

tresB
Champion III
Champion III

Could you post your sample app with the issue?

Not applicable
Author

Yes, here is a demo app with public data.

tresB
Champion III
Champion III

Put '=' in variable definition. See attached.

Not applicable
Author

Try =avg($(=$(vMenu)))

Not applicable
Author



Try =avg($(=$(vMenu)))

I tested with selecting Sloop. it works. for other fields Menu list does not have corresponding same name in the fields..

Not applicable
Author

Thanks, I had tried with '=', but I must have made some typo. Anyway, now it works:

set vMenu = ='[' & GetFieldSelections([Menu Item]) & ']';

tresB
Champion III
Champion III

Yes, that would be required for values with spaces in between.