Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank() from two dimension Aggr()

Dear All,

Please let me know how can get the Rank() from two Dimension Table ( via Aggr() function)

i want to get the Member rank of a specific city like 'MUMBAI'

RANK(aggr(Sum(TRADE_VALUE),CITY,MEMBERID))

Kindly help

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Well, I have loaded your above table, created a straight table with Dimension CITY and as expression

= Min( aggr( Rank(Sum({1} "TOTAL")), CITY, MEMBER))

then selected Member A:

CITY = Min( aggr( Rank(Sum({1} "TOTAL")), CITY, MEMBER)) sum("TOTAL")
2 350
DELHI2200
MUMBAI2100
PUNE250
KOLKATA 0

Select B:

CITY = Min( aggr( Rank(Sum({1} "TOTAL")), CITY, MEMBER)) sum("TOTAL")
1 650
KOLKATA1100
MUMBAI1200
PUNE1250
DELHI3100

Select C:

CITY = Min( aggr( Rank(Sum({1} "TOTAL")), CITY, MEMBER)) sum("TOTAL")
1 550
DELHI1500
MUMBAI350
KOLKATA 0
PUNE 0

Looks to me like what you requested. Have you even tried?

View solution in original post

12 Replies
sunny_talwar

Do you have a sample that you can share?

swuehl
MVP
MVP

In which context are you using this expression?

In a chart using which dimensions?

In a text box?

Rank() should be used within a table, not as an aggregation outside.

= Max( aggr( Rank(Sum(TRADE_VALUE), CITY, MEMBERID))

Max() is just a guess, no idea what you are trying to achieve.

Not applicable
Author

i am using in CITY dimensions

Not applicable
Author

there is my requirement.

i want to select a Member and want to show CITYWISE, TRADE_VALUE of a Member. But along with the TRADE_VALUE, I also want to know is Rank() CITYWISE

swuehl
MVP
MVP

Ok, within a chart with dimension CITY.

And you select a Member, but want to return the rank compared to all (unselected) members?

Try

= Min( aggr( Rank(Sum({1} TRADE_VALUE), CITY, MEMBERID))


to ignore the Member selection for the rank calculation.

Not applicable
Author

becasue each city there are multiple member so according to members turnover on city what is his rank()

Not applicable
Author

below is my requirement with sample data

MEMBERCITYTOTAL
AMUMBAI100
APUNE50
ADELHI200
BDELHI100
BPUNE250
BMUMBAI200
BKOLKATA100
CMUMBAI50
CDELHI500

Now when i select Member 'A' i want to get CITY wise TOTAL along with the rank compare to other MEMBERS like

CITYA-TOTALRANK
MUMBAI1002
PUNE502
DELHI2002
KOLKATA00

Kindly note this is just for a sample purpose. the actual records have more dimensions (YEAR,MONTH,DATE,etc)

swuehl
MVP
MVP

= Min( aggr( Rank(Sum({1} [TOTAL])), CITY, MEMBER))


seems to work for me.

Not applicable
Author

Hi,

i think you did not get my requirement, below is sample

MEMBERCITYTOTAL
AMUMBAI100
APUNE50
ADELHI200
BDELHI100
BPUNE250
BMUMBAI200
BKOLKATA100
CMUMBAI50
CDELHI500

In the above case if we see closely then we found in Mumbai,  'A'  MEMBER have '2' Rank , and in PUNE, 'A' have '2' RANK.

So when i want to show CITYWISE TOTAL of 'A' Member, on the same time i want to show his TOTAL RANK with compare to other Member. like 'B' TOTAL is more and 'C' TOTAL is less so at MUMBAI he RANK '2' as on

CITYA-TOTALRANK
MUMBAI1002
PUNE502
DELHI2002
KOLKATA00

here RANK() should me caluclated on the basis on MEMBERS respective CITY .