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

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 - Specialist
Partner - Specialist

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 - Specialist
Partner - Specialist

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 - Contributor III
Partner - Contributor III
Author

what limitation did you use in the table itself?

 

thakurdagautam
Partner - Contributor III
Partner - Contributor III
Author

also i am having issues with the expression

thakurdagautam_0-1635340073182.png

 

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

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 - Contributor III
Partner - Contributor III
Author

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

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 - Contributor III
Partner - Contributor III
Author

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

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Great 🙂