Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

KPI objects: returning a rank for a specific dimension value

Hi there

I am having some trouble returning a rank in a KPI object.  I have used the expression from this previous thread: Rank in Textbox as KPI  but this approach does not seem to work with my data.

I have survey data with respondents from around 20 countries and they were asked which destinations they were considering visiting from a list of 50-odd destinations. I want to return Australia's rank, i.e. where Australia is placed among the 50-odd destinations. I need to be able to filter the data to obtain ranks by country of origin, for example.

See attached files. I have been able to show the rank of each destination in a bar chart. I have also been able to return the name of the destination which is ranked #1 (first KPI on the left), and I can filter this by origin.

However, using the expression: aggr(rank(TOTAL Sum({$<Destination={"Australia"}>} Selection)), Destination) just returns '1' even when Australia is not ranked #1.

What method do I need to use to show Australia's rank among various sub-groups of the data?

Any help would be greatly appreciated.

Thank you

Emma

1 Solution

Accepted Solutions
Highlighted

Try this:

Only({$<Destination={"Australia"}>}Aggr(Rank(Sum(Selection)), Destination))

Capture.PNG

View solution in original post

4 Replies
Highlighted

Try this:

Only({$<Destination={"Australia"}>}Aggr(Rank(Sum(Selection)), Destination))

Capture.PNG

View solution in original post

Highlighted
Not applicable

Hi Sunny

Perfect, thank you so much!

Emma

Highlighted
Partner
Partner

Thanks so much for this answer!  I've been trying to figure out how to subset the result of an aggr for use in a KPI all morning.  This did the trick!

Pat

Highlighted
Contributor II
Contributor II

Hi Sunny,

I was trying another expression to change the destination based on field selection.

var1=GetFieldSelections(Destination)

Only({1<Destination={"$(var1)"}>}Aggr(Rank(Sum(Selection)),Destination))

Couldn't make it work. Can you tell what could be wrong. Appreciate your help!

Thanks!
VS