6 Replies Latest reply on Oct 1, 2018 11:20 AM by Janice Ip

# How to sort top N with Filter Formula base on a different variable.

So I have a parameter that already filter Nationality (International and National)

This is an example of how my data is organized

 Nationality Date Location of origin District Unique Count International Jan-18 USA North 3502 International Jan-18 USA North 3824 International Jan-18 USA South 5652 International Jan-18 EUR South 5855 International Feb-18 USA North 3150 International Feb-18 EUR North 4041 International Feb-18 CHN South 5776 International Feb-18 CHN South 2125 International Mar-18 USA North 2677 International Mar-18 CHN North 4598 International Mar-18 EUR South 4667 International Mar-18 CHN South 5943 International Apr-18 USA North 4519 International Apr-18 CHN North 4074 International Apr-18 EUR South 2421 International Apr-18 CHN South 2725 National Jan-18 BC North 1611 National Jan-18 ON North 2850 National Jan-18 BC South 2008 National Jan-18 ON South 2745 National Feb-18 ON North 1443 National Feb-18 AB North 2651 National Feb-18 AB South 1597 National Feb-18 BC South 2327 National Mar-18 ON North 1998 National Mar-18 AB North 2670 National Mar-18 AB South 2148 National Mar-18 ON South 2057 National Apr-18 AB North 2658 National Apr-18 ON North 1863 National Apr-18 BC South 1272 National Apr-18 ON South 1478

The problem I have with sorting with top in the filter menu is menu can't read the Numbers from International because the count from International are much lower than Nationals

And tableau is reading the data only from location of origin so it is not sorting International and National individually.

• ###### 1. Re: How to sort top N with Filter Formula base on a different variable.

Hi Janice,

Please post .twbx file. This would help us in solving your problem.

~Tushar

• ###### 2. Re: How to sort top N with Filter Formula base on a different variable.

Sorry, can't do that

• ###### 3. Re: How to sort top N with Filter Formula base on a different variable.

Try using a filter with Rank calculation and compute using Table Down.

Is this the result you are looking for upon filtering. I have rearranged Nationality to columns?

1 of 1 people found this helpful
• ###### 4. Re: How to sort top N with Filter Formula base on a different variable.

I think that's what I want. But I can't figure out how to do it

• ###### 5. Re: How to sort top N with Filter Formula base on a different variable.

so the rank formula is -- RANK(sum(Unique Count)). Let me know if there are other issues in doing this.

• ###### 6. Re: How to sort top N with Filter Formula base on a different variable.

Thank Anuvir. Now I have a new problem.

So I tried the rank formula and it works with my other graph

For this graph I don't have to rank them within the months. I just to rank and sort them so I only see the trend of the top N.

As you see in the picture. I've filtered Rank to show just the top 2 trends but for some reason an extra point shows up. (The pink dot near April)

The problem get worst when the range gets larger

I need to show the same number of trend line as the range selected. No extra dots

Any suggestion? Thank you