Tableau Rank Calculation Basic

In this article, we will show you, How to do the Tableau Rank Calculation with an example. For this Tableau Rank calculation demo, we will use the Employee table to present the SQL Server.

I suggest you refer to Connecting to SQL Server article to understand the configurations. The following screenshot will show you the data inside the Table, and as you can see, it has 14 records:

Sql Table source 1

Before we get into the example, let me show you the list of available ranking options in Tableau.

Available OptionsResult
Competition (1, 2, 2, 4)This option assigns the identical rank to Identical values and skips the next rank. For example, if we have 100, 200, 300, 300, or 400, then this option will assign ranks as 1, 2, 3, 3, 5
Modified Competition (1, 3, 3, 4)The modified Competition option assigns an identical rank to duplicate values. The Highest value will rank as 1, and the following two identical values will rank as 3. The next value ranked as 4. For example, if we have 100, 200, 300, 300, or 400, then this option will assign ranks as 1, 2, 4, 4, 5
Dense (1, 2, 2, 3)The dense option assigns the identical rank to Identical values, but it will not skip the next. For example, if we have 100, 200, 300, 300, or 400, then this option will assign ranks as 1, 2, 3, 3, 4
Unique (1, 2, 3, 4)This Tableau Rank option allocates unique values to every record. Though there are identical values, they assign a unique ranking. Here, the ranking factor decides by the Order we specify.

Ascending and Descending Order Option: Under the Tableau Rank Calculation Type, we have two options:

  1. Ascending: Tableau Rank will be assigned, starting from lowest to highest. For example, if we have 100, 200, 300, 300, or 400, then it will set ranks as 1, 2, 3, 3, 5
  2. Descending: Starting from highest to lowest, the Rank will award. So, for example, if we have 100, 200, 300, 300, or 400, then it will assign ranks as 4, 3, 2, 2, 1.

Tableau Rank Calculation Basic

In this example, we will show you the basic approach to calculating the tableau Rank. For this, we are going to Drag and Drop the Occupation, Last Name, First Name from Dimensions Region to Rows Shelf, and Yearly Income from Measures region to Text filed present in the Marks Shelf.

Basic Crosstab report 2

To assign the Tableau Ranks, we have to add the table calculation. To do so, click the Down arrow beside the Yearly Income measure (change as per requirement) and opens the context menu.

You can select the Add Table Calculation option from the list of available options or the Quick Table Calculation option. We are now choosing the Quick Table Calculation option and the Rank option.

Tableau Rank Quick Table Calculation Basic 3

Once you select the Rank option, Tableau assigns the ranks for each record based on the Yearly Income values.

Tableau Rank Calculation Basic 4

It will be nice to show the yearly Income values so that you can compare the Rank value with the yearly Income. So, let us add the Yearly Income to the Columns Shelf. As you can see, it will create a Horizontal Bar chart. Please use the Show Me window to change the bar chart to Text.

Bar Chart 5

The following screenshot will show you a better view of the Tableau Rank calculation.

Tableau Rank Calculation Basic 6

Alter the Tableau Rank Calculation

To edit the existing table calculation, please click on the down arrow beside the table calculation will open the context menu. Here you have to select the Edit Table Calculation option.

Edit Tableau Rank Calculation Basic 7

Once you click on the Edit Table Calculation option, a new window called Table Calculation will open. As you can see, tableau has selected the Rank Calculation Type as Competition (1, 2, 2, 4) and Compute using the option as Specified Dimensions (Occupation, Last name, and First Name) by default. Here, you can uncheck the unwanted dimensions, as well.

Tableau Rank Calculation Specific Dimension 8

Let us change the Rank calculation type from Competition to Modified Competition (1, 3, 3, 4), and you can see the change in Rank.

Modified Competition 9

Let us change the Rank calculation type from Modified Competition (1, 3, 3, 4) to Dense (1, 2, 2, 3), and you can see the change in Rank.

Tableau Rank Calculation Dense Basic 10

Finally, we changed the Rank calculation type from Dense (1, 2, 2, 3) to Unique (1, 2, 3, 4). And you can see the change in Rank

Tableau Rank Calculation Unique Basic 11

Tableau Rank Calculation for Cross-Tab reports

In this example, we show you how to calculate the rank in tableau for the cross tabled reports (OR) and calculate the rank for each partition. We removed the First name from Rows Shelf and changed the Compute Using the option to the pane (down then across). We don’t have cross tabs here, so it will calculate by going down.

First, we changed the Rank Calculation type to Competition (1, 2, 2, 4), and you can see the result. It is calculating the Rank for each Partition (here, it is Occupation)

Tableau Rank Calculation Competition Basic 12

Let us change the Tableau Rank calculation type from Competition to Modified Competition (1, 3, 3, 4). From the below screenshot you can see the Modified Competition Rank partitioned by occupation

Tableau Rank Modified competition Calculation Basic 13

Let us change the Rank calculation type from Modified Competition (1, 3, 3, 4) to Dense (1, 2, 2, 3). From the below screenshot, you can see the Dense Rank partitioned by occupation.

Tableau Rank Calculation Dense Descending Basic 14

Lastly, we changed the Tableau Rank calculation type from Dense (1, 2, 2, 3) to Unique (1, 2, 3, 4). You can see the Unique Rank partitioned by occupation

Down Then Across Along Pane 15

Tableau Rank Calculation Second Approach

Please click on the down arrow beside the measured value (Here it is Yearly Income) will open the context menu. Here you have to select the Add Table Calculation option.

Tableau Rank Calculation 16

Once you click on the Add Table Calculation option, a new window called Table Calculation will open.

Difference from Table down 17

Please change the calculation type from the Difference From option to Tableau Rank.

Tableau Rank Calculation 18

Next, change the Compute Using option from a table (down) to Pane (across then down)

Compute using pane across then down 19