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

top 15 records in pivot or straight table

Hi All,

How to achieve top 15 records  in pivot or straight table.

Thanks

12 Replies
rubenmarin

Hi in straight table you can configure dimension limits, but if you want in pivot or quick-change graph you can use a calculated dimension, in example to filter top 15 Cutomers by Sales:

=Aggr(If(Rank(Sum(Sales))<=15, Customer), Customer)

prma7799
Master III
Master III
Author

Hi Ruben,

Top 15 records coming properly but in the first row one - is coming i dont want this but it will never effect on my total when i am hiding - .

And I dont want scroll in that pivot table.

Thanks

MK_QSL
MVP
MVP

Consider that you have below in your script... Below examples are for TOP 10 but you can change it for top 15.

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

Not applicable

Hi,

We can use dimension limits tab to set top 15 in the straight table.

In pivot table it can be acheived by writing expression like Aggr(If(Rank(Sum(Sales))<=15, Customer), Customer).

rubenmarin

Not sure to understand... if you want the total to sum only filtered dimension you can use this expression:

Sum(Aggr(If(Rank(Sum(Sales))<=15, Sum(Sales)), Customer)) //This way you don't need calculated dimension.

Anyway Manish has given a lot of option to achieve the requirements

mohammadkhatimi
Partner - Specialist
Partner - Specialist

Hie..


=Aggr(If(Rank(Sum(Fieldname))<=15, Fieldname), Fieldname)



Hope this will helps you...!!

Regards,

Mohammad

Anonymous
Not applicable

Hi,

Pivot Table:

Calculated DImension:

=AGGR(IF(Rank(SUM(REVENUE),4)<=15,NAME),NAME)

Check 'SUPPRESS WHEN VALUE IS NULL'

Expression:

As per your requirement

Straight Table:

Dimension : Customer

Expression : =SUM({<Customer = {"=Rank(SUM(Sales),4)<=15"}>}Sales)



Regards

Neetha

prma7799
Master III
Master III
Author

Hi Manish,


Thanks for your response am getting top 15 but am getting one - records it will come on top row that row i don't want show the user .

please see the attachment in that how to hide and after hide that row total should remain as it is 8900.

Thanks

MK_QSL
MVP
MVP

Tick suppress when value is null in Dimension Tab