5 Replies Latest reply on Jun 16, 2016 1:58 PM by Shinichiro Murakami

# Top N and other with a row before

Good morning,

I just had the Idea to create a Top N per country for the locations where we settled directly.

For this I follwed the article

But I think I miss something where I don´t know how to go forward.

When you look at the attachement you will see a row which is called "D.Country"

The Idea now is to find the Top 10 Countries for each "D.Country" and sort them descending.

And this is not working. Any Idea how I can get this done?

• ###### 1. Re: Top N and other with a row before

Hi Jens,

Please find the attached screenshot and confirm the output.

I have some different approach to this. I have created a calculated field which will give me Rank based on the Number Record. Then put the same in the filter and select 1-10. You will get the desired result.

Attaching the same tableau 9.3.

Thanks and Regards,

Ashish Chaudhari

• ###### 2. Re: Top N and other with a row before

Hi,

I like the Idea to work with Rank but for any reason I am too stupid to sort this in the pane

As you can see on your pic,too the Numbers are not sorted.

any idea how to do this?

• ###### 3. Re: Top N and other with a row before

Hi Jens,

I actually tried lot of options to get it sorted but I don't know why its not getting sorted. I have actually went ahead and changed the formula as below.

RANK_UNIQUE(SUM([Number of Records]),'asc')

Unable to sort the same in the context of D.Country and Country context. I guess its because D.country is calc field. Not sure about it.

Mahfooj Khan, any help on this is appreciated.

-Ashish

• ###### 4. Re: Top N and other with a row before

Hi Shinichiro,

I hope you are doing good. Sorry for tagging you in here but the scenario is output is ready but just I am not able mange the sort with 2 dimensions.

I have saw your reply on Rank with 2 dimensions. Above I am able to get the result but unable to sort the same in ascending order based on number of records. Any help will be appreciated.

-Ashish

• ###### 5. Re: Top N and other with a row before

Using "Index" with sroting instead of using "Rank" seems working.

Create calculated field

[D.Country + Country]

[Country]+"_"+[ D.Country]

And sort this field.

[index]

Put Index in the filter shelf.

Thanks,

Shin

9.3 attached.