Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QLIKWORLD LIVE! MAY 16 - 19TH, EARLY BIRD DISCOUNTS! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
thakurdagautam
Partner
Partner

Using top and bottom button in a single variable input to show "N" number also based on self input.

I am trying to figure out a method of using variable input where i previously only used a single variable TOP or BOTTO to find the top N values. i want to consolidate and use both in a single input where i can specify the N of values and select TOP or BOTTOM and directly show in a single chart.

i was thinking of using rank and aggr. Any hints?

1 Solution

Accepted Solutions
AshutoshBhumkar
Partner
Partner

Hello,

I have created a sample, check if that works for you.

 

vTopBottom : To check if Top is selected or Bottom.

vTopBottomValues : To get input of top/bottom

Expression : 

If(vTopBottom = 1,
If(Rank(Sum(Value))<=$(vTopBottomValue),Sum(Value))
,
If(vTopBottom = 2,
If(Rank(-Sum(Value))<=$(vTopBottomValue),Sum(Value))
))

Output :

AshutoshBhumkar_1-1635315647299.pngAshutoshBhumkar_2-1635315661665.png

 

Thanks,

Ashutosh

 

View solution in original post

8 Replies
AshutoshBhumkar
Partner
Partner

Hello,

I have created a sample, check if that works for you.

 

vTopBottom : To check if Top is selected or Bottom.

vTopBottomValues : To get input of top/bottom

Expression : 

If(vTopBottom = 1,
If(Rank(Sum(Value))<=$(vTopBottomValue),Sum(Value))
,
If(vTopBottom = 2,
If(Rank(-Sum(Value))<=$(vTopBottomValue),Sum(Value))
))

Output :

AshutoshBhumkar_1-1635315647299.pngAshutoshBhumkar_2-1635315661665.png

 

Thanks,

Ashutosh

 

thakurdagautam
Partner
Partner
Author

what limitation did you use in the table itself?

 

thakurdagautam
Partner
Partner
Author

also i am having issues with the expression

thakurdagautam_0-1635340073182.png

 

AshutoshBhumkar
Partner
Partner

Hello,

Sum(Value) is a KPI in my dataset.

Use KPI as per your dataset and try.

 

No limitation is used in tables, Row limit is managed using Rank() function

thakurdagautam
Partner
Partner
Author

i used sum(sales amount). i posted a screeenshot as well.
AshutoshBhumkar
Partner
Partner

Hi,

In the screenshot, Value KPI is used. which is not present in your dataset.

Also, looks like vTopBottomValue variable in not getting calculated.

Please check that in KPI object if that works on button selection.

 

Thanks,

Ashutosh

thakurdagautam
Partner
Partner
Author

yes it works. I was having some functional issues on my end. thank you very much.

AshutoshBhumkar
Partner
Partner

Great 🙂