Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
richters
Partner - Contributor III
Partner - Contributor III

Dimension - all Postal Codes of Top 3 Cities

Hi all,

I want to create a dimension with all postal codes of the top 3 cities regarding sales.

I ended up creating a dimension with the top 3 cities:

=aggr(if(rank(sum({<$(vYTD)>}sales)) <=3, city),city)

But how can I now get all of the related postal codes of these 3 cities?

Thanks for any help!

1 Solution

Accepted Solutions
sunny_talwar

Try this

=If(Aggr(NODISTINCT Rank(Sum(Sales)), City) <= 3, PostalCode)

View solution in original post

6 Replies
sunny_talwar

Have you tried this

=Aggr(If(Rank(Sum(TOTAL <city> {<$(vYTD)>} sales)) <= 3, PostalCode), city, PostalCode)

richters
Partner - Contributor III
Partner - Contributor III
Author

Aparently, that's what I thought would be right. But aparenty, Qlik is giving me much more (I think nearly all) postal codes back...

sunny_talwar

Would you be able to share a sample to show the issue using the above expression?

richters
Partner - Contributor III
Partner - Contributor III
Author

Here you are, it is simplified on the problem.

sunny_talwar

Try this

=If(Aggr(NODISTINCT Rank(Sum(Sales)), City) <= 3, PostalCode)

richters
Partner - Contributor III
Partner - Contributor III
Author

Wow, thanks. Exactly!