Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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!