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:

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

Available Options | Result |
---|---|

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:

- 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
- 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 will Drag and Drop the Occupation, Last Name, and First Name from the Dimensions Region to the Rows Shelf and Yearly Income from the Measures Region to the Text field present in the Marks Shelf.

- Guide to the Advanced Method of Calculating the Rank.

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.

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

It will be nice to show the yearly Income values to 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.

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

### Alter or Edit 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.

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.

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

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

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

## 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 calculates the Rank for each Partition (here, it is Occupation)

### Calculation Type as Modified Competition

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

### Calculation Type as Dense(1, 2, 2, 3)

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.

### Calculation Type as Unique

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

### 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.

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

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

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