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 10 values

Hi all,

I have one fields called division it has 15 records now am using that as list box.

My requirement is i want only top 10 records from list box.

How can i achieve it.

Thanks

1 Solution

Accepted Solutions
Kushal_Chawda

what is logic to define Top 10 in list box? Is it on Sales or on some amount? If it is so you can do something like this

In listbox properties , in drop down select expression and use below expression

=aggr(if( rank(sum(Amount),4)<=10,Division), Division)

Please find the attached

View solution in original post

15 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Aggr(If(FieldIndex('division', division) <= 10, division), division)

The best thing is arrive the top 10 fields in script and use that field in listbox

Data:

LOAD

*,

If(RowNo() <= 10, division) AS Top10Div

FROM DataSource;

Now use Top10Div as listbox.

Hope this helps you.

Regards,

jagan.

datanibbler
Champion
Champion

Hi,

you can add a new object and select the type >listbox<. Then you can add formulas (as well as fields) and you can also enter some condition. I haven't found out yet exactly how to do it, but experiment a bit with that (try with the max() function, that lets you specify the top_10).

Alternatively, you could use a straight_table chart for that, with a dimension of '1' (not to be displayed), so only one column will be visible.

HTH

prma7799
Master III
Master III
Author

Hi Jagan,

=Aggr(If(FieldIndex('division', division) <= 10, division), division)


The above statement is not working.


Thanks

Kushal_Chawda

what is logic to define Top 10 in list box? Is it on Sales or on some amount? If it is so you can do something like this

In listbox properties , in drop down select expression and use below expression

=aggr(if( rank(sum(Amount),4)<=10,Division), Division)

Please find the attached

prma7799
Master III
Master III
Author

Hi Kush,

Can you explain me below statement

=aggr(if( rank(sum(division),4)<=10,Division), Division)

Thanks

prma7799
Master III
Master III
Author

Hi Kush,

Very sorry I used your expression but value is not coming.

PFA in that i want red mark first top 10.

Kushal_Chawda

Rank function is checking the Top 10 Values by Division using Rank(sum(Value),4)<=10, and assigning the Division name (if( rank(sum(Value),4)<=10,Division))by aggregating the values by division which is whole statement

Kushal_Chawda

Please share your sample app

prma7799
Master III
Master III
Author

PFA.