Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jixiaoquan
Contributor III
Contributor III

Get The Name of Top 1 Sales

Hi everyone,

     I have a table about the sales,now I want to know who is top 1 order by the total sales.I want to show the Name in a text.

     QQ截图20160628104044.png

     I have use this :=if(Aggr(sum(Sales),name)=max(Aggr(sum(Sales),name)),name)

  but it does not work .

     Could you tell me how to solve this problem?

1 Solution

Accepted Solutions
sunny_talwar

May be this:

FirstSortedValue(Name, -Aggr(Sum(Sales), Name))

or

FirstSortedValue(DISTINCT Name, -Aggr(Sum(Sales), Name))

View solution in original post

4 Replies
sunny_talwar

May be this:

FirstSortedValue(Name, -Aggr(Sum(Sales), Name))

or

FirstSortedValue(DISTINCT Name, -Aggr(Sum(Sales), Name))

jixiaoquan
Contributor III
Contributor III
Author

Hi Sunny,

     Thank you very much.You are right.

manoranjan_d
Specialist
Specialist

Hi Sunny Opening the thread again for another scenario example below data have two persons have max(sale), now to show two name in the text box

manoranjan_d
Specialist
Specialist

Hi sunny,

Achieved with the help of rank function, in order to show multiple names have  top  1

=concat(if(aggr(rank(sum(Sale)),Name)='1',Name),',')