Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
claudialet
Contributor III
Contributor III

How to write expression based on variable value ?

 Hello here are my requirements. 

sum ( amount) 

Dimension is  'Company' 

I have a slider with variable value of 50. vSlider  = 50  ,  min = 0  and max = 50 

 

The vslider should be able to rank on the fly the top' N' companies by amount  in ascending order.

If  ($(vSlider) ) >0, rank ( aggr( sum ( amounts), Company)) , asc)   

 

1 Solution

Accepted Solutions
timpoismans
Specialist
Specialist

This still seems solvable with the limitation setting and sorting.

 

The limitation used together with the variable vSlider should limit your top N you want to show.

 

Sorting measure could be something along the lines of:

If(vSlider>0,Sum(Amount),Company) 

That way, it would sort according to Company when not using the slider (as in, it being 0 or below any value really), and when using the slider (above 0, or any number you set) it'll sort according to your measure.

View solution in original post

5 Replies
timpoismans
Specialist
Specialist

Wouldn't it work if you use the "Limitation" setting of your dimension in the table, with sorting on Sum(Amount)? Just fill in the variable as the Limitation, uncheck "Show others" and you should be good to go.

claudialet
Contributor III
Contributor III
Author

Yes that works but it does not rank the companies based on amounts in ascending order.
If user selects '3' on vSlider it just shows 3 companies not top 3 companies.

Also if sorting in done on the table. By default it will always be sorted by asc order.  I am looking to rank on the fly .

timpoismans
Specialist
Specialist

When using the limitation setting on a dimension, it should limit the dimension based on the first measure. It should show the top 3 companies.

And how does a table not fit your needs? It'll show the ranked companies based on the vSlider value? In what object would you want to show the ranked companies?

claudialet
Contributor III
Contributor III
Author

 Qliksense pivot table

timpoismans
Specialist
Specialist

This still seems solvable with the limitation setting and sorting.

 

The limitation used together with the variable vSlider should limit your top N you want to show.

 

Sorting measure could be something along the lines of:

If(vSlider>0,Sum(Amount),Company) 

That way, it would sort according to Company when not using the slider (as in, it being 0 or below any value really), and when using the slider (above 0, or any number you set) it'll sort according to your measure.