Announcements
cancel
Showing results for
Did you mean:
Not applicable

## in qlikview i want take top 10 salaries how to wright ?

i have employee table and their salaries i  want take top 10 in qlikview  not  in   sql

1 Solution

Accepted Solutions
MVP

Consider that you have below in your script...

Employee:

[

Employee, Salary

A, 10000

B, 20000

C, 24000

D, 40000

E, 100000

F, 50000

G, 125000

H, 80000

I, 75000

J, 40000

K, 50000

L, 35000

M, 25000

N, 50000

O, 35000

P, 20000

];

===================================

1) Using Calculated Dimension

Dimension = Calculated Dimension

=IF(Aggr(Rank(SUM(Salary),4),Employee)<=10,Employee)

Tick Suppress When Value is NULL

Expression = SUM(Salary)

2) Using Set Analysis in Expression

Dimension = Employee

Expression = SUM({<Employee = {"=Rank(SUM(Salary),4)<=10"}>}Salary)

3) Using Dimension Limit

Dimension = Employee

Expression = SUM(Sales)

Dimension Limits

Select Show only Largest 10 Values

4) If you want to show in Text Box

=CONCAT(IF(Aggr(Rank(SUM(Salary),4),Employee)<=10,Aggr(Employee&CHR(9)&MONEY(SUM(Salary),'#,##0'),Employee)),', '&CHR(10),-Aggr(SUM(Salary),Employee))

5) Using Script

Employee:

[

Employee, Salary

A, 10000

B, 20000

C, 24000

D, 40000

E, 100000

F, 50000

G, 125000

H, 80000

I, 75000

J, 40000

K, 50000

L, 35000

M, 25000

N, 50000

O, 35000

P, 20000

];

NoConcatenate

Temp:

Load Employee, SUM(Salary) as Salary Resident Employee Group By Employee;

NoConcatenate

Final:

First 10

Load Employee, Salary Resident Temp Order By Salary Desc;

Drop Tables Employee, Temp;

Hope this helps...

18 Replies
Creator III

There are number of ways to find top n:

One Way:

Sum({<Employee = {"=rank(sum(salaries), 4)<= 10"}>} salaries)

Second Way:

make a variable vtopN

and in dimension limits you pas that variable with selection of Greatest value

Creator III

If you have any issue then share me your qvw

MVP

Please check enclosed file showing different ways to get top 10 employee based on salary..

1) Using Calculated Dimension

2) Using Set Analysis in Expression

3) Using Dimension Limit

4) How to show TOP 10 Employees based on Salary in Text Box along with Name and Salary..

Hope this helps..

Not applicable
Author

pls give clear explination

in all ways   like    using above  1,2,3,4  how to right expressions

Creator III

MVP

You can view Top 10 by the chart properties also from chart properties -> Dimension Limit -> show largest select 10.

MVP

There are many ways you can show Top 10

1. From load script you can find top 10

2. From SET analysis expression.

3. From any variables in expression by input box.

4. From chart properties Dimension limits.

4. In any Bar charts also.

Regards

MVP

Consider that you have below in your script...

Employee:

[

Employee, Salary

A, 10000

B, 20000

C, 24000

D, 40000

E, 100000

F, 50000

G, 125000

H, 80000

I, 75000

J, 40000

K, 50000

L, 35000

M, 25000

N, 50000

O, 35000

P, 20000

];

===================================

1) Using Calculated Dimension

Dimension = Calculated Dimension

=IF(Aggr(Rank(SUM(Salary),4),Employee)<=10,Employee)

Tick Suppress When Value is NULL

Expression = SUM(Salary)

2) Using Set Analysis in Expression

Dimension = Employee

Expression = SUM({<Employee = {"=Rank(SUM(Salary),4)<=10"}>}Salary)

3) Using Dimension Limit

Dimension = Employee

Expression = SUM(Sales)

Dimension Limits

Select Show only Largest 10 Values

4) If you want to show in Text Box

=CONCAT(IF(Aggr(Rank(SUM(Salary),4),Employee)<=10,Aggr(Employee&CHR(9)&MONEY(SUM(Salary),'#,##0'),Employee)),', '&CHR(10),-Aggr(SUM(Salary),Employee))

5) Using Script

Employee:

[

Employee, Salary

A, 10000

B, 20000

C, 24000

D, 40000

E, 100000

F, 50000

G, 125000

H, 80000

I, 75000

J, 40000

K, 50000

L, 35000

M, 25000

N, 50000

O, 35000

P, 20000

];

NoConcatenate

Temp:

Load Employee, SUM(Salary) as Salary Resident Employee Group By Employee;

NoConcatenate

Final:

First 10

Load Employee, Salary Resident Temp Order By Salary Desc;

Drop Tables Employee, Temp;

Hope this helps...

Creator III