Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

newbie: how to get total of all values in addition to selected

I want users to be able to select a single company and see it's total sales in relation to the average sales for all companies..

How do I select all the values for sales and not just those that are currently selected.

ABC CO:   $3,484,223       45% of average of $8,334,233

Ideas?

thanks!

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Maybe this?

avg(aggr(sum({<Company=>} Sales),Company))

View solution in original post

3 Replies
johnw
Champion III
Champion III

Maybe this?

avg(aggr(sum({<Company=>} Sales),Company))

Not applicable
Author

thanks john.

I'm not familar with some syntax here.

If the field name is Company, is this literal with all the brackes... "{<Company=>}"  ?

Thanks!

johnw
Champion III
Champion III

The expression assumed your field name is "Company".  The bracket portion is set analysis, which would be good to look up in the reference manual or help text, as it's a very powerful feature (though also difficult to master and with hard to follow syntax).  In short, set analysis lets you look at a set of data that is different than currently selected.  This particular set analysis tells the expression to ignore any selections in the Company field, so should give you "all" companies.  Some companies may be skipped if, say, you've selected a specific year, and you didn't do business with that company that year.  The selected year would also be taken into account in that you'd only be looking at the average sales to companies that year.  Other sets could match other definitions of "average sales for all companies", but the one I gave seemed the most likely to meet your needs.