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

Automatically selecting the "top" 5 entries to filter by

Hi,

I am looking for a way to "filter/select" by clicking  a button I'll place on the canvas.

The filter should be on a specific dimension ('partners') and auto select the 5 TOP (largest is their values) partners with respect to a certain expression = cout(impressions)

The same should also be done with the TOP 90% of the expression.

I know there is a "dimension limits" , but thats not apropriate for this type.

Finally, is there a way to modify the expression using a slider. So for example, I can set the slider to '7' and then the filter/select will filter the 'top 7' partners.

Thanks

Gur

6 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

First an answer to the second question: yes there is! Create a slider that changes a variable (define the variable in your script or in the variables overview), add suitable lower and upper limits to the slider and display the result in some text box, just to check that it works (for example, add a text box with ='Top $(vVariableYouJustDefined) Partners' as an expression)

I'm not entirely sure I understand your first question. You're not asking to really select some partners in a listbox by pressing a button, right? If not, you can reduce the number of partners shown in a graph or a table by using the same variable in Dimension Limits or in the Chart->Presentation field that limits the number of dimension values shown. Just replace the expected number by the same $(vVariableYouJustDefined).

Good luck,

Peter

Not applicable
Author

Hi Peter,

Thanks for the answer. Its works great.

But I have a challenge here. I think I know how to use the 'dimension limit', but I didnt see anything relevant in 'presentation'.

The problem with dimension limit is that I cant always use it.

I'll try to explain:

1. My first chart shows the number of users per partner, and I want to show the 'TOP' partners with users.

--> This is where the dimension limit works great

2. My second chart shows a  metric I am calculating. But its a precentage and I really want to use the same partners I "selected" in the first chart.

--> If I'll use "dimension limit" here I will not get the same partner list.

--> With Dimension Limit I need to have the "limiting expression" first, but I can't. I am using a bar chart with two dimensions, and using only one expression, so I'll get it for all of my second dimensions.

Any idea how to get the same partners selected for the second chart, based on the first chart "auto" selection created by the slider ?

Thanks !

Gur

Gysbert_Wassenaar

Have a look at the example I posted here. One chart uses dimension limits, the other a set analysis expression using the rank function in a set modifier. Maybe you can use that approach in your document.


talk is cheap, supply exceeds demand
Peter_Cammaert
Partner - Champion III
Partner - Champion III

With Chart->Presentation I meant the option under "Chart Scrolling". Sort your graph according to Y-value and limit with the field "When number exceeds..."  You'll be stuck with the X-axis scroll bar, but in my case that didn't matter much and you'll still have the other values available, just in case...

To couple X-axes of two charts with the same Dimension, you can use the previous sorting&limiting trick but the second chart will be sorted according to Expression. Enter the expression of the first chart in the expression field and order/reduce so that the same view is obtained as in the first one. This doesn't work in all cases though (for example, expression of the second chart may return NULL values and the correct order will be lost) but again in my case it was sufficient. And simple.

Gysbert's example probably has none of these limitations, so check it out.

Best,

Peter

Not applicable
Author

Thanks Peter. It doesn't seem to work for me, as my X axis is Days, and when Iimit the Xaxis scrolling I just get 3 days

Not applicable
Author

Thanks Gysbert for helping here.

I was trying to use the set analysis -

({<Customer_Name={"=rank(sum(total <Customer_Name> Sales))<=$(vTopCust)"}>

In my expression.

But the expression originally was -

count(installviewAction)/count(if(campaign_id>0,clickviewAction))

So trying to addin the relevant set-expression yields:

count({<partner_name={"=rank(sum(total <partner_name> impressionAction))<=$(TopPubCount)"}>}installviewAction)/count(if(campaign_id>0,clickviewAction))

But I get nothing.

Is there a good way to debug expressions like this ?

Generally I find the set-analysis very difficult and not intuitive. I know its  one of the most powerfull aspect of QV, but seems I can't get it to become "intuitive" for me to design and code.

Thanks

Gur