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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis problem

Hi, I have a problem with the expression below. It basically gives me the account name with the best score to a set of questions in a particular industry.

It works fine until I make a selection on the account name field, when it only calculates it for that account name. But I have put "account name =" in the set analysis which should override the selection but it doesn't. I have also tried a 1 instead of a $.

max(aggr(sum(aggr([Savings]*((round(avg({$ <Industry = {'$(vIndustry)'},[Account Name] =>}[Question Response]))-1)/4),

[Question Number], [Account Name])),[Account Name]))

My options are to calculate it in the script or to make the account name selection a data island so I never make a real selection on that field. Any ideas?

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

There was still an implicit aggregation in there. Change aggr([Savings] into aggr(only({<[Account Name]>}[Savings])


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try adding a set modifier to the other aggregation functions too:

max({<[Account Name]=>} aggr(sum({<[Account Name]=>}aggr([Savings]*((round(avg({$ <Industry = {'$(vIndustry)'},[Account Name] =>}[Question Response]))-1)/4),

[Question Number], [Account Name])),[Account Name]))


talk is cheap, supply exceeds demand
Not applicable
Author

No it still only calculates on one account code sorry. I think it might be that the aggr function is using [Account name]. I am going to create a data island with all of the account names in and use that in the aggr function instead.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

There was still an implicit aggregation in there. Change aggr([Savings] into aggr(only({<[Account Name]>}[Savings])


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert, that's brilliant - it works perfectly now.