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: 
Not applicable

how to display top or bottom Results,by a button

Hi community members,

In my chart contains sum(sales) of Patiens, in dimension limits we can set largest 10 or smallest ten .But my requirement is ,we set a button to give largest 10

if we click, without changing the chart.Is it possible

Regards

rams

1 Solution

Accepted Solutions
Not applicable
Author

Hello Rams,

You can add a variable for that purpose. Let's say vTop.

In the dimension limits of the chart, first set whether you want Smallest or Largest, then, instead of putting a fixed number as 10, you would put: =vTop.

Now if you prefer to add buttons to make the user choose between the largest 10, 20, 100 values, you can repeat the below step for as many buttons as you want:

Add a button > 'Actions' tab > Add > External > Set Variable

In the variable field put : vTop

In the value field put : 10

But instead of using buttons, I would suggest to add a slider object and in the 'General' tab, set the following:

Data: Variable > vTop

Mode: Single Value

Min Value: 0

Max Value: 100

Static Step: 1

You can then set your scale in the 'Presentation' tab.

In addition, if your chart is a Straight Table, you can get use of the option "Allow Interactive Sort" in the 'Sort' tab and instead of using the "Dimension Limits", you can check "Max Number" in the 'Presentation' tab and put: =vTop. Now you have the ability to double-click on any of your columns in order to view the top or bottom results based on the value you assign to vTop using the slider object.

Hope this helps you get a quick overview of the possible options (that I know) and choose the one that you find more suitable to your case.

View solution in original post

7 Replies
Not applicable
Author

Hello Rams,

You can add a variable for that purpose. Let's say vTop.

In the dimension limits of the chart, first set whether you want Smallest or Largest, then, instead of putting a fixed number as 10, you would put: =vTop.

Now if you prefer to add buttons to make the user choose between the largest 10, 20, 100 values, you can repeat the below step for as many buttons as you want:

Add a button > 'Actions' tab > Add > External > Set Variable

In the variable field put : vTop

In the value field put : 10

But instead of using buttons, I would suggest to add a slider object and in the 'General' tab, set the following:

Data: Variable > vTop

Mode: Single Value

Min Value: 0

Max Value: 100

Static Step: 1

You can then set your scale in the 'Presentation' tab.

In addition, if your chart is a Straight Table, you can get use of the option "Allow Interactive Sort" in the 'Sort' tab and instead of using the "Dimension Limits", you can check "Max Number" in the 'Presentation' tab and put: =vTop. Now you have the ability to double-click on any of your columns in order to view the top or bottom results based on the value you assign to vTop using the slider object.

Hope this helps you get a quick overview of the possible options (that I know) and choose the one that you find more suitable to your case.

jagan
Luminary Alumni
Luminary Alumni

Hi Ramesh,

I think it is not possible to do this in a single chart using Dimension Limits, you can do this by using two charts.  One for Top 10 and another for Bottom 10 and you can show hide this charts based on the button click.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Here is a solution.

In your dimension tab , add a dimension like this one :

(in that case I want to show the top x and bottom x of sales territories based on the salesamount)

You have to create a variable named vartop ....

And that should work.

=if(aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName) <= $(Vartop) or

aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName) >= (Max(total aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName))- $(Vartop)),

SalesTerritoryName)

if you want to add the rank #

add a second dimension like this one:

=aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName)

as per you expressions , you can use the one you need.

Hope that help

Philippe

Not applicable
Author

Thanks Motillon ,its great....

Not applicable
Author

Hi Bakache,

Can we do this by gauge charts also,can you help me please

Regards,

rams    

Not applicable
Author

Yes Rams, there is a way to display top/bottom values in gauge charts

For that, you can use the expressions that Philippe suggested above.

This is how I've tried it (choose the gauge style that best reflects your need, I used the LED number as I wanted to display amounts):

In the 'Dimensions' tab of the gauge chart, add a calculated dimension as:

=if(aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName) <= $(Vartop), SalesTerritoryName)

Still in the 'Dimensions' tab but to the bottom, click on 'Trellis' and then check the box 'Enable Trellis Chart'.

In the 'Expressions' tab add this: sum(NetSalesAmount).

Now you have a chart with several gauges that will represent the top vartop territories in NetSalesAmount.

You can add now another gauge chart with a calculated dimension of:

=if(aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName) >= (Max(total aggr(Rank(aggr(sum(NetSalesAmount),SalesTerritoryName)),SalesTerritoryName))- $(Vartop)), SalesTerritoryName)

That chart will show you the bottom vartop territories in NetSalesAmount.

Don't forget to enable the trellis in that gauge too

Hope this is what you're looking for.

AleCruc94
Contributor III
Contributor III

hi, 

 

sorry but since I am interested in this.. how actually my variable should be created?  Could you please write here the text?

Thanks u