Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
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
Champion III
Champion III

try

FirstSortedValue(EmpName,-Sal)

or

Max(Sal)

Max(Sal,1)

Max(Sal,2)

jsingh71
Partner
Partner

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

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.

nivetha40
Contributor III
Contributor III

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

View solution in original post