How to Find Mode in Tableau
If you're looking for a simple MODE() function in Tableau, you might be surprised to find it doesn't exist. Unlike calculating an average or a sum, finding the most frequently occurring value in a dataset requires a bit more nuance. This guide will walk you through two effective methods to find the mode in Tableau, from a quick visual approach to a more powerful technique using Level of Detail (LOD) expressions.
Why Isn't There a Simple MODE() Function in Tableau?
Before jumping into the "how," it's helpful to understand the "why." Tableau is designed to work with aggregated data. Functions like SUM(), AVG(), and COUNT() perform a single operation across a set of rows to return one value. Finding the mode, however, is a two-step process:
- First, you need to count the occurrences of every unique value in a dimension (e.g., how many times each product category appears in your sales data).
- Second, you need to identify which of those unique values has the highest count.
This multi-step logic requires more context than a simple aggregation function can provide, which is why Tableau relies on more advanced features like LOD expressions or table calculations to get the job done.
Method 1: The Quick Visual Approach
The fastest way to find the mode is to let Tableau's visual engine do the work. This method is perfect for quick analysis or when you don't need to use the mode in another calculation. Let’s say we want to find the most common Sub-Category in the Sample - Superstore dataset.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step-by-Step Instructions:
- Drag Your Dimension to Columns: Drag the dimension you want to analyze, in this case
Sub-Category, from the Data pane to the Columns shelf. - Drag a Count to Rows: To count how many times each sub-category appears, drag the
Orderstable (from the top of the Data pane) to the Rows shelf. Tableau will automatically create aCOUNT(Orders)measure for you. You'll now see a bar chart showing the count for each sub-category. - Sort the Chart: To easily spot the mode, click the Sort icon in the toolbar. This will arrange your bars from highest to lowest count.
That’s it! The sub-category with the longest bar is your mode. In the Superstore data, you'll see that "Binders" is the most frequently purchased sub-category. While this method is incredibly fast, its limitation is that you can't easily reference the result ("Binders") in another calculation or display it dynamically in a dashboard title.
Method 2: The Powerful LOD Expression Approach
For more flexibility, Level of Detail (LOD) expressions are the way to go. This method allows you to isolate the mode and use it in other calculations, labels, or filters. It involves creating a few calculated fields, but it’s a robust solution that can handle almost any scenario, including ties for the mode.
Let's stick with our goal of finding the most frequent Sub-Category.
Step 1: Count the Occurrences of Each Item
First, we need to create a calculation that counts the number of times each unique sub-category appears across the entire dataset. We’ll use a FIXED LOD for this.
Create a new calculated field:
- Name:
[Sub-Category Count] - Formula:
{ FIXED [Sub-Category] : COUNT([Orders]) }
What this does: For each individual Sub-Category, it counts the total number of orders and "fixes" that value to it. Every row for "Binders" will now have the same [Sub-Category Count] value associated with it, every row for "Paper" will have its own count, and so on.
Step 2: Find the Maximum Count
Now that we know the count for every sub-category, we need to find out what the highest count is across all of them. We'll use another FIXED LOD for this, but this time, it will check the entire dataset.
Create a second calculated field:
- Name:
[Max Sub-Category Count] - Formula:
{ FIXED : MAX([Sub-Category Count]) }
What this does: Since we didn’t specify a dimension before the colon, this expression looks at the entire dataset, finds the maximum value produced by our [Sub-Category Count] calculation, and returns that single value for every row in the data source. For example, if "Binders" has the highest count at 1523, this calculation will return 1523 for every single row.
Step 3: Identify the Mode Itself
We're almost there. We have the count for each item and we know the maximum count. The final step is to compare the two. If an item’s count equals the maximum count, then it is the mode.
Create a third calculated field:
- Name:
[Mode - Sub-Category] - Formula:
IF [Sub-Category Count] = [Max Sub-Category Count] THEN [Sub-Category] END
What this does: This calculation checks each row. If the count for that row's sub-category is the same as the overall maximum count, it returns the Sub-Category name. If not, it returns a NULL value. This effectively isolates only the mode(s).
Step 4: Using Your New Mode Calculation
Now you have a dynamic field called [Mode - Sub-Category] that contains only the most frequent value(s). Here’s how to use it:
- Display the mode as text: Drag
[Mode - Sub-Category]onto the Text mark on the Marks card. To get rid of the "Null" indicator, you can filter them out by dragging[Mode - Sub-Category]to the Filters shelf and excluding Nulls. - Create a dynamic KPI card: You can create a new sheet and place
[Mode - Sub-Category]on the Text mark to create a simple card that says "Binders." You can then add this to a dashboard. - Perform further analysis: You can use this calculated field to filter your other charts to only show data for the most common sub-category.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
What If There Is a Tie? (Bimodal or Multimodal Data)
A great advantage of the LOD method is that it handles ties gracefully. If two or more sub-categories share the same highest count, the [Mode - Sub-Category] calculation will return all of them. For example, if "Binders" and "Paper" both had 1523 orders, dragging the final calculated field to your view would show both names. This automatically accounts for bimodal or multimodal distributions without any extra work.
Final Thoughts
Calculating the mode in Tableau isn't a one-click action, but mastering it opens up a new level of analysis. By using either a quick visual sort for fast insights or a robust set of FIXED LOD expressions, you can confidently identify the most frequent values in your data and integrate them directly into your dashboards.
This process of building multi-step calculations to answer a seemingly simple question is common in traditional BI tools. It often involves a lot of learning and trial-and-error - and it's exactly the kind of manual work we built Graphed to automate. Instead of thinking in terms of LODs and aggregations, you can simply ask a question in plain English like, "show me the most common sub-category by number of orders," and instantly get the answer visualized for you in a real-time dashboard. Our goal is to handle the technical complexities so you can focus on the insights.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.