Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

Showing top 10 by button

Hi Community Team,

I have requirement like below

I wanted to show top 10 countries by button

I created a Pivot table in that dimension is Country and expression1 - sum(sales), expression2 - sum(sales1) - expression 2 used for only sorting and its hidden in presentation tab.

so, once I click on button then top 10 countries should show.

Please help me.

1 Solution

Accepted Solutions
Not applicable

Hi Priya,

I tried a different approach and it is working for me.

Please find the attached qvw hope it will help you.

Thanks,

Harika

View solution in original post

22 Replies
sunny_talwar

You can create an expressions which is conditional based on the value of a variable.

If(vVar = 0, Sum(Sales), Sum({<Country = {"Rank(Sum(Sales)) <=10"}>} Sales))

Your button will have an action which set vVar to be =If(vVar = 0, 1, 0)

I hope this helps.

Best,

Sunny

ecolomer
Master II
Master II

here you have an example

ecolomer
Master II
Master II

more

priyarane
Specialist
Specialist
Author

Hi Sunindia,

thank for reply. could you please brief about it.

My requirement is.

Dim: Country    Expression: Sum(Sales)

India                         20000

Brazil                        19000

US                            18000

Canada                      16000

Kenya                         15000

France                         60000

UK                               5000

Germany                         3000

so,

Now, in my 1st button action should be - top 3--  so once I click on it then India, Brazil, US should display in Chart

like that I have top4 button etc....

priyarane
Specialist
Specialist
Author

Thank for reply Enrique.

My requirement should be display by button like below

Dim: Country    Expression: Sum(Sales)

India                         20000

Brazil                        19000

US                            18000

Canada                      16000

Kenya                         15000

France                         60000

UK                               5000

Germany                         3000

so,

Now, in my 1st button action should be - top 3--  so once I click on it then India, Brazil, US should display in Chart

like that I have top4 button etc....

Not applicable

So you want a button that on the first touc will give you top3, on the second - top 4 and so on?

priyarane
Specialist
Specialist
Author

Yes,

but separate button like 1st button - top3 countries and second button top4 countries.

My requirement should be display by button like below

Dim: Country    Expression: Sum(Sales)

India                         20000

Brazil                        19000

US                            18000

Canada                      16000

Kenya                         15000

France                         60000

UK                               5000

Germany                         3000

so,

Now, in my 1st button action should be - top 3--  so once I click on it then India, Brazil, US should display in Chart

like that I have top4 button etc....

sunny_talwar

Please find attached:

Minor edit to the expression: If(vVar = 0, Sum(Sales), Sum({<Country = {"=Rank(Sum(Sales)) <=10"}>} Sales))

Best,

Sunny

maxgro
MVP
MVP

button action       select in field

search action     ='$(v)'

variable v             ='(' & concat(if(aggr(Rank(Sum(sales)),country)<=3,country), '|') & ')'

1.png