What is the RANK Function in Tableau?

Cody Schneider8 min read

Nothing tells a story faster than a ranked list. Whether it's identifying your top-performing products, least efficient marketing campaigns, or most productive sales reps, ranking is a cornerstone of business analysis. If you're using Tableau, the RANK function is your key to unlocking these insights. This article will walk you through exactly what the Tableau RANK function is, the different types available, and how to use them with step-by-step examples.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is the RANK Function in Tableau?

The RANK function in Tableau is a table calculation that assigns a numerical rank to each row in a partition based on a specific measure. In simpler terms, it sorts your data and tells you the order of each item - first, second, third, and so on. This is incredibly useful for creating leaderboards, highlighting top or bottom performers, and comparing members within a group.

For example, you could use it to answer questions like:

  • Which of my products are in the top 10 for sales this quarter?
  • How do our regional sales totals stack up against each other?
  • Which blog posts are driving the least amount of traffic?

The basic syntax for the function is quite simple:

RANK(expression, ['asc' | 'desc'])

  • expression: This is the measure you want to rank, typically an aggregated field like SUM([Sales]) or AVG([Profit]).
  • ['asc' | 'desc']: This optional argument specifies the sort order. 'desc' (descending) ranks the highest value as 1, while 'asc' (ascending) ranks the lowest value as 1. If you omit this, Tableau defaults to descending order.

The Four Types of RANK Functions in Tableau

Tableau doesn't just have one ranking function, it has four. Each function handles ties - when multiple rows have the same value - in a different way. Choosing the right one is essential for getting the analysis you expect.

Imagine you have the following sales data:

  • David: $5,000
  • Susan: $5,000
  • Maria: $4,000
  • Liam: $3,000

Here’s how each RANK function would handle this dataset:

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

1. RANK()

This is the standard "competition" rank. It gives identical values the same rank but then skips the subsequent rank(s). It's just like in sports - if two runners tie for second place, they both get a silver medal, and no one gets bronze, the next person gets fourth place.

  • David: 1
  • Susan: 1
  • Maria: 3
  • Liam: 4

Notice how rank 2 is skipped because of the tie.

Use When: You want a traditional ranking where ties share a rank, and the presence of ties impacts the total number of unique ranks.

2. RANK_DENSE()

Dense rank also gives identical values the same rank, but it does not skip any ranks in the sequence. This is useful when you want a continuous list of ranks regardless of ties.

  • David: 1
  • Susan: 1
  • Maria: 2
  • Liam: 3

Here, Maria is ranked 2nd. No numbers are skipped.

Use When: You need an unbroken sequence of ranks, like for a sales leaderboard where you don't want gaps in the numbering.

3. RANK_MODIFIED()

Modified rank is sometimes called "modified competition ranking." It assigns the same rank to tied values, similar to RANK(). However, the rank assigned is the highest possible rank a member of that tied group could have achieved.

  • David: 1
  • Susan: 1
  • Maria: 3
  • Liam: 4

To better see the difference, imagine this sales list instead: Liam ($5k), David ($4k), Susan ($4k), Maria ($3k).

  • RANK() would give David and Susan rank 3 (a tie for 2nd and 3rd).
  • RANK_MODIFIED() assigns them rank 2. It uses the last ordinal number for the tied group, which highlights their position relative to the last person.

This is less commonly used but can be helpful in specific statistical scenarios.

4. RANK_UNIQUE()

Unique rank assigns a different, consecutive rank to every row, even if an exact tie exists. For tied values, Tableau will assign the ranks in an arbitrary but consistent order based on the underlying data sort.

  • David: 1
  • Susan: 2
  • Maria: 3
  • Liam: 4

Even with identical sales, David and Susan get unique ranks.

Use When: You absolutely need every single row to have its own distinct rank, and breaking ties arbitrarily is acceptable for your analysis.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

How to Use the RANK Function: A Step-by-Step Guide

Let's walk through a practical example using the Sample - Superstore dataset included with Tableau. Our goal is to rank product sub-categories by their total sales.

Step 1: Set Up Your Basic View

First, we need to create a simple table showing what we want to rank.

  1. Drag the Sub-Category dimension to the Rows shelf.
  2. Drag the Sales measure to the Columns shelf.
  3. Click the Sort button in the toolbar to sort the sub-categories by sales in descending order. This helps visualize the ranking before we even create the calculation.

Your view should look something like this, with "Phones" and "Chairs" at the top.

Step 2: Create the Calculated Field

Now, we'll create the calculation that does the ranking.

  1. Click the down arrow in the top left of the Data pane and select Create Calculated Field.
  2. Name your calculation something clear, like "Sales Rank".
  3. In the formula window, type: RANK(SUM([Sales])).
  4. Click OK.

Your new "Sales Rank" field now appears in the Measures section of the Data pane.

Step 3: Add the Rank to Your View and Configure It

The final step is to add our new rank to the table.

  1. Drag your "Sales Rank" calculated field from the Measures pane and drop it onto the Rows shelf, to the left of the Sub-Category pill.
  2. You'll notice the rank pill is green and the view looks strange. This is because Tableau has defaulted to treating the rank as a continuous measure.
  3. To fix this, right-click the "Sales Rank" pill on the Rows shelf and select Discrete. The pill will turn blue, and the numbers will display correctly as ranks (1, 2, 3...).

Your final view now shows each sub-category neatly ranked by sales, with "Phones" ranked as #1. That's it!

Going Deeper: Understanding the "Compute Using" Setting

Once you've mastered the basics, the next level of ranking involves controlling the scope of the calculation. This is handled by Tableau's "Compute Using" setting. This tells Tableau how to apply the ranking: should it rank everything in the table, or should it restart the rank for each group?

Let's build a slightly more complex view to demonstrate this.

  1. Put Category on the Columns shelf.
  2. Keep Sub-Category on the Rows shelf.
  3. Put your "Sales Rank" calculated field on the Rows shelf as well (make sure it's discrete).
  4. Put SUM(Sales) on Text in the Marks card.

Initially, you'll see a single ranking from 1 to 17 across all three categories in the view. This is because Tableau defaults to "Table (Down)." This may not be what you want. What if you wanted to see the rank of a sub-category within each parent category?

To change this behavior:

  1. Right-click your "Sales Rank" pill.
  2. Hover over Compute Using.
  3. Select Pane (Down).

Instantly, the view changes. Now, the ranking restarts for each pane (Category). You'll see a rank 1, 2, 3, 4 for Furniture, then another 1, 2, 3… for Office Supplies, and so on. This powerful feature lets you create nested rankings to answer more refined business questions like "Who is our top salesperson in each region?"

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Practical Use Case: Finding the Top 5 Products by Profit

Let’s put it all together. A common request is to build a view that dynamically shows only the top N results.

  1. Create a view with Product Name on Rows and SUM(Profit) on Columns, sorted descending.
  2. Create a calculated field named "Profit Rank" using the formula: RANK(SUM([Profit])).
  3. Change the "Profit Rank" field to discrete.
  4. Place "Profit Rank" on the Filters shelf.
  5. In the filter dialog box that appears, select a range of numbers from 1 to 5.
  6. Click OK.

Voila! Your view is now filtered to show only the top 5 most profitable products. You can even make this filter more dynamic by right-clicking it and selecting "Show Filter" to let users control how many "top" products they see.

Common Ranking Mistakes and How to Avoid Them

As you work with ranking functions, you might encounter a few common hurdles. Here’s what to look out for.

  • Forgetting to Set the Rank as "Discrete": This is the number one issue for beginners. A green, continuous rank pill tries to plot values on an axis, which doesn't make sense for a list of ranks. Always remember to right-click and set it to Discrete for clean, tabular results.
  • Using the wrong "Compute Using" Setting: If your ranks don't look right, especially in a view with multiple dimensions, the "Compute Using" setting is almost always the cause. Double-check that you're partitioning the calculation correctly - by Table, Pane, or a specific dimension - to get the scope of ranking you need.
  • Picking the Wrong Rank Type for the Job: Before you type your formula, think about how ties should be handled. Do you need a gapless leaderboard? Use RANK_DENSE(). Do you care about a standard competition-style rank? Use RANK(). Choosing the right function upfront saves you headaches later.

Final Thoughts

The RANK family of functions in Tableau are powerful tools for ordering your data and quickly highlighting key performers. By understanding the differences between the four types - Rank, Dense, Modified, and Unique - and mastering the "Compute Using" setting, you can create insightful, dynamic reports that answer important business questions with clarity.

Of course, becoming proficient in tools like Tableau takes time. Learning a new function, creating calculated fields, wrestling with settings, and building dashboards from scratch is time-consuming. We built Graphed because we believe getting insights shouldn't require you to become a specialist. Instead of the manual steps above, you can simply ask, "show me my products ranked by profit for last quarter," and instantly get an answer with real-time, interactive dashboards built for you automatically.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!