Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

Tags (3)
1 Solution

Accepted Solutions
MVP
MVP

Re: Show ranking for selected product(s)

Try this:

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


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

7 Replies
MVP
MVP

Re: Show ranking for selected product(s)

Try this:

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


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

Not applicable

Re: Show ranking for selected product(s)

hey, thanks for the quick reply,

unfortunately this still shows me rank 1 for every selected product :/

MVP
MVP

Re: Show ranking for selected product(s)

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

Not applicable

Re: Show ranking for selected product(s)

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!

Not applicable

Re: Show ranking for selected product(s)

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

abhijain
New Contributor III

Re: Show ranking for selected product(s)

Hi sunny,

This expression is working fine.

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

MVP
MVP

Re: Show ranking for selected product(s)

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))