Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
arjunmadhusudan
Contributor III
Contributor III

calculate highest ranked sales excluding the selected company

Hi,

I have data as below

Company    Sales

A                  1000

A                     400

B                    500

B                      20 

C                  2000

D                    400

D                      20

I need to calculate     Sum of sales selected company /   Sales of company with highest sale from the remaining list ( not selected)

Regards,

Arjun

1 Solution

Accepted Solutions
13 Replies
olivierrobin
Specialist III
Specialist III

hello

i think you can achieve that by ysing set analysis with e() set modifier

ie :

sum for selected company / sum( e(selected company))

arjunmadhusudan
Contributor III
Contributor III
Author

I need only want company with max sales in the denominator from the not selected list.

olivierrobin
Specialist III
Specialist III

something like

max(aggr(sum(value),company)) combined with the exclusion of the selected one

qv_testing
Specialist II
Specialist II

PFA,

arjunmadhusudan
Contributor III
Contributor III
Author

Oliver,

Also I want display the name of this company. How should I modify the expression to display the name of the company in the denominator?

olivierrobin
Specialist III
Specialist III

you could use only(<set analysis compuying the max value>company name)

qv_testing
Specialist II
Specialist II

Have tried my attached file ??

arjunmadhusudan
Contributor III
Contributor III
Author

Oliver,

refer below expression where cursale is my sales and Name is my company name which I want to display.

Only({<Max({< Name = e(Name) >} Aggr(Sum({<Name = e(Name)>}CurSale),Name))>}Name)

I m not getting any result using this.

Anonymous
Not applicable

Hi Arjun,

For Value You can use the aggr function. For company name i am not sure where you want to show the company name i.e expression ot title of chart. However, if You want to show the name of company you can use first sorted value as below .

=FirstSortedValue(distinct {<Company=e(Company)>}Company, aggr(-sum({<Company=e(Company)>}Sales),Company),1)

I hope this helps.