Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
soha1902
Creator
Creator

Top values

Hi All,

I have data like:

1.png

Now I want to display Top Employee name based on Salary. I need to display 5 text Boxes and In first text Box Higest Paid employee name, in second box 2higest salary paid employee name and so on.

Please suggest How should I get Top2, Top3 employee name based on there salary.

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi,

in Text Box 1

=FirstSortedValue(DISTINCT EmpName,-Aggr(Sum(Sal),EmpName),1)

in Text Box 2

=FirstSortedValue(DISTINCT EmpName,-Aggr(Sum(Sal),EmpName),2)

and so on

Regards,

Antonio

View solution in original post

6 Replies
Chanty4u
MVP
MVP

try

FirstSortedValue(EmpName,-Sal)

or

Max(Sal)

Max(Sal,1)

Max(Sal,2)

jsingh71
Partner - Specialist
Partner - Specialist

For First Text Box you should write:

=if(aggr(rank(Sum(Sal)),EmpName)=1,EmpName)

for 2nd

=if(aggr(rank(Sum(Sal)),EmpName)=2,EmpName)


and so on.....

tamilarasu
Champion
Champion

Hi Soha,

Try this,

=Concat( Distinct IF(Aggr(Rank(Sum(Sal),0,1),EmpName)=1,EmpName),',')

=Concat( Distinct IF(Aggr(Rank(Sum(Sal),0,1),EmpName)=2,EmpName),',')

=Concat( Distinct IF(Aggr(Rank(Sum(Sal),0,1),EmpName)=3,EmpName),',')

The above expression works even If  two or more employes have same salries.

Anonymous
Not applicable

Hi Soha ,

Try the below expressions ,

=FirstSortedValue(EmpName,-Sal)

=FirstSortedValue(EmpName,-Sal,2)

=FirstSortedValue(EmpName,-Sal,3)

=FirstSortedValue(EmpName,-Sal,4)

=FirstSortedValue(EmpName,-Sal,5)

Image.png

beck_bakytbek
Master
Master

Hi Soha,

you can use the Chart, and use as Dimension:EmpName and as Expression: Salary,

and if you want to Show (for instance) 5 Top Employ, you can use a calculated Dimension:

if (aggr(rank(sum(Salary)), EmpName) <=5, EmpName, Null()) and Forget to check: Supress When Value is Null,

i hope that helps

beck

antoniotiman
Master III
Master III

Hi,

in Text Box 1

=FirstSortedValue(DISTINCT EmpName,-Aggr(Sum(Sal),EmpName),1)

in Text Box 2

=FirstSortedValue(DISTINCT EmpName,-Aggr(Sum(Sal),EmpName),2)

and so on

Regards,

Antonio