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: 
woshua5550
Creator III
Creator III

Get rank in textbox

Hello experts

I need a expression in a textbox which will show current selected city's rank

plz have a look at the sample data below

CityAmount
Beijing100
Shanghai500
Beijing200
Chongqing150

when I select "Beijing" it should return "2" , when I select "Shanghai" it should return "1" ,"Chongqing" is "3"

I don't  want to deal with it during data loading,plz give me the frontend solution

thanks

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

=Aggr(rank(Sum({<City>}Amount)),City)

View solution in original post

5 Replies
tresesco
MVP
MVP

Try like:

=Aggr(rank(Sum({<City>}Amount)),City)

woshua5550
Creator III
Creator III
Author

Thanks Bro! It works

but how should I change this expression if I use alternate states on city filter ?

let's say I have city in a list box with Alternate States "G1" and  textbox with default states

I tried "=Aggr(rank(Sum({G1<City>}Amount)),City)" but it doesn't work

plz help , thank you

pooja_prabhu_n
Creator III
Creator III

Try like this in text box

=aggr(rank(sum( {1<city=>}  Amount)),city)

sunny_talwar

Try this may be

=Only({G1} Aggr(Rank(Sum({<City>} Amount)), City))

woshua5550
Creator III
Creator III
Author

Excellent ! Thank you Sunny!