Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead 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
MK_QSL
MVP
MVP

Consider that you have below in your script...

Employee:

Load * Inline

[

  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:

Load * Inline

[

  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...

View solution in original post

18 Replies
arsal_90
Creator III
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

arsal_90
Creator III
Creator III

If you have any issue then share me your qvw

MK_QSL
MVP
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

arsal_90
Creator III
Creator III

can u share your qvw

its_anandrjs

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

its_anandrjs

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

MK_QSL
MVP
MVP

Consider that you have below in your script...

Employee:

Load * Inline

[

  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:

Load * Inline

[

  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...

arsal_90
Creator III
Creator III

Please find the attached file