Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Find the Max & get a related field

Hi,

My problem is simple but I can't find out a simple solution.

Suppose I have a table with 3 fields : Country, City , Number of Inhabitants

I'd like to create a straight table with

Country,

Name of the city which as the maximum of inhabitants for a country (or the minimum)

Of course, I don't want to do this in the script.

Thanks for your help

Jean-Jacques

1 Solution

Accepted Solutions
Not applicable
Author

I found out in another post a tricky function FirstSortedValue.

=FirstSortedValue(city, NumInhbtians) give the smallest

=FirstSortedValue(city, - NumInhbtians) give the biggest

thanks again for your time

JJ

View solution in original post

5 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

try this example

hope its helps

regards

Not applicable
Author

Thanks a lot. The tip is to calculate the biggest city in the dimension area not in the expression,.

Do you have idea about the smallest city ?

Regards

Jean-Jacques

lironbaram
Partner - Master III
Partner - Master III

hi

it took me some time to figure it out

but here is example inckuding tje minimum value

in both tables you can play with how many city per country you want to show

hope it solves your question

regards and good night

liron

Not applicable
Author

Shalom Liron,

Thanks for your time & i'm sure you deserve a good night.. It's perfect.

cheers

Jean-Jacques

Not applicable
Author

I found out in another post a tricky function FirstSortedValue.

=FirstSortedValue(city, NumInhbtians) give the smallest

=FirstSortedValue(city, - NumInhbtians) give the biggest

thanks again for your time

JJ