Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Show ranking for selected product(s)

Hi guys,

I would like to display a rank for a selected product. What I have now is a table with the Dimension 'productname' and a measure like that: 'rank(sum(SALES))' . What that does without filtering is to show me the ranks for each product nicely in a table. But as soon as I filter on a productname I always get Rank 1 for that product. Which makes sense of course, but what I need is that the measure shows me the actual rank for the product. Can someone help me on that?

Best regards

1 Solution

Accepted Solutions
Highlighted

Try this:

Rank(Sum({1} SALES)) * Avg(1)


UPDATE: Fixed the expression to add the missing parenthesis after the OP pointed out.

View solution in original post

7 Replies
Highlighted

Try this:

Rank(Sum({1} SALES)) * Avg(1)


UPDATE: Fixed the expression to add the missing parenthesis after the OP pointed out.

View solution in original post

Highlighted
Not applicable

hey, thanks for the quick reply,

unfortunately this still shows me rank 1 for every selected product 😕

Highlighted

Are you sure you added {1} to the sum(sales) expression?

Highlighted
Not applicable

yeah Im sure, I just copy pasted what you posted and added a bracket, which seems to miss?

So: Rank(Sum({1} SALES) * Avg(1)) is what i used.

This is what I get with your suggestion:

QlikCapture.jpg

Sense still seems to make a new ranking based on what I filter on 😕

EDIT: Ok I see... I put the bracket at the wrong position. My bad and thank you!

Highlighted
Not applicable

One more question:

Is it possible to display this rank as a KPI ? Whats the syntax for that? It doesnt seem to work for the same syntax

Again, thank you very much

Highlighted
Partner
Partner

Hi sunny,

This expression is working fine.

Can you please explain how avg(1) is working.

Highlighted

So you can try this, but this will display a comma separated list of all ranks when you haven't selected a single productname.

Concat(Aggr(Rank(Sum({1} SALES)) * Avg(1), ProductName), Chr(10))

If you only ever want to see this when you have only one selected, then may be this:

Only(Aggr(Rank(Sum({1} SALES)) * Avg(1), ProductName))