Search code examples
tableau-apirank

Tableau How to evenly split a Ranking Table into two


I am trying to evenly split a ranking table into two.

I tried to create a calculated field using rank to divide the data into two groups. enter image description here enter image description here

The problem with this approach is that there are too many entries in the first column because they are tie with rank 1.

enter image description here

I don't want to break the tie but display evenly in both columns.

So, desired output will look like...

25 states with Rank 1 are displayed in column 1, and the rest 12 rank 1 states and the other states from rank 38 to 49 are displayed in column 2.


Solution

  • In order to split your rows within a specif number (say 25) you can't rely just on rank due to same values for multiple rows.

    Even though your Rank calculated field must be shown in the chart, you can add another calculated field based on rank_unique which will provide you a progressive number for rows having the same value for the specified metric.

    enter image description here

    Just use the specified function:

    RANK_UNIQUE(SUM([Value]),'desc')
    

    And then use the calculated field as a filter to "split" the results as you need (in this example 1-4, 5-8).

    enter image description here