Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Determine the RANK of a dimension not in Chart

Let's assume a simple source table like this:

 

COUNTRYCARSALES
DECar_11
DECar_22
FRCar_14
FRCar_23

From that I would like to derive a straight table that lists the COUNTRY and

1. who sells most (Top Seller)

2. what's the specific rank for a certain car, e.g. Car_1

Hence the result should look like this:

 

COUNTRYTop_SellerRank of Car_1
DECar_22
FRCar_11

Currently I am struggeling to find the correct expressions for these two columns. (In reality there is also a time dimension, that need to be aggregated to determine the rank.)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try an expression like

=only({<BRAND = {B}>} aggr( rank(sum( UNITS)), COUNTRY, BRAND))

View solution in original post

6 Replies
ramoncova06
Specialist III
Specialist III

this should help

sunny_talwar

This:

Capture.PNG

Expression 1: =FirstSortedValue(CAR, -SALES)

Expression 2: =If(Sum({<CAR = {'Car_1'}>} SALES) > 0, Rank(Sum(SALES), 4))

HTH

Best,

Sunny

Not applicable
Author

Thank you very much RamonCova06‌ & sunindia‌. Your solutions work fine for the first issue, but when I extend the data a little bit it unfortunately fails for the second. I attached my demo file with a little bit more enhanced data. Maybe someboy has an idea how to obtain the expected values in the third column (RANK OF BRAND B).

swuehl
MVP
MVP

Try an expression like

=only({<BRAND = {B}>} aggr( rank(sum( UNITS)), COUNTRY, BRAND))

sunny_talwar

You are damn fast.

I was working my way to the solution, but you got there so fast. I hope to be like you one day

Thanks for sharing your knowledge swuehl

Best,

Sunny

Not applicable
Author

swuehl‌ & sunindia‌ Thank you very much for your quick replies and effort !!