How to Create a Toggle Button in Tableau

Cody Schneider7 min read

A static dashboard shares information, but an interactive dashboard starts a conversation. One of the best ways to make your Tableau dashboards more engaging and user-friendly is by adding a toggle button. This simple addition lets your audience control what they see - switching between different metrics, chart types, or detailed views - without cluttering the interface. This tutorial will walk you through exactly how to build an interactive toggle button from scratch using parameters and dashboard actions.

What is a Toggle Button and Why Bother?

In web and app design, a toggle is a switch that moves between two states, like on and off. In Tableau, we can create a similar experience. Instead of forcing users to use a dropdown menu, which can feel clunky, a visual toggle button provides a clean, intuitive way for them to interact with your data.

Here are a few great reasons to use them:

  • Conserve Dashboard Space: Instead of showing two separate charts for Sales and Profit, a toggle lets you display either one in the same spot. This is invaluable when working with limited dashboard real estate.
  • Improve User Experience (UX): Toggles feel modern and are instantly understandable. They guide your users, making complex dashboards feel less intimidating and more like a custom application.
  • Focus User Attention: By allowing users to switch views, you empower them to focus on the metric that’s most important to them, leading to a more personal and effective analysis.

The Building Blocks: Parameters and Calculated Fields

Before we dive into the steps, it’s important to understand the two core Tableau features that make toggles possible: Parameters and Calculated Fields. If you’re already familiar with these, feel free to skip ahead.

What is a Parameter?

Think of a parameter as a variable that you, the creator, define, but the user gets to control. It isn't tied to any specific field in your data source by default. Instead, it’s a placeholder value - like a number, a date, or a piece of text - that you can link to filters, sets, reference lines, and, most importantly for us, calculated fields.

For our toggle button, we'll create a parameter that lets the user choose between two text values, for example, "Sales" and "Profit."

What is a Calculated Field?

A calculated field is a way to create a new field in your dataset by applying a formula to your existing fields. You might use it for simple math (like Profit / Sales to get Profit Ratio) or more complex logical statements.

We'll use a calculated field to connect our parameter to our data. The calculation will essentially say, "IF the user's parameter selection is 'Sales,' THEN show the [Sales] measure. IF the selection is 'Profit,' THEN show the [Profit] measure."

Step-by-Step Guide: Creating a Sales vs. Profit Toggle

Let's build a common example: a toggle that switches a time-series line chart between showing total sales and total profit. We will use the Sample-Superstore dataset that comes with Tableau.

Step 1: Create Your Parameter

First, we need to create the parameter that will store the user's choice.

  1. In the Data Pane on the left, click the small dropdown arrow at the top and select Create Parameter.
  2. A new window will open. Configure your parameter as follows:
  3. Click OK. You'll now see "Select a Metric" in the Parameters section at the bottom of your Data Pane.

Step 2: Create the Calculated Field

Now, let's create the calculated field that links our parameter choice to our actual measures.

  1. Click the same dropdown arrow in the Data Pane and select Create Calculated Field.
  2. Name this field Dynamic Metric.
  3. Enter the following formula in the calculation box:
CASE [Select a Metric]
WHEN "Sales" THEN [Sales]
WHEN "Profit" THEN [Profit]
END

This CASE statement checks the current value of the "Select a Metric" parameter. If the value is "Sales", it returns the values from your [Sales] measure. If it's "Profit", it returns values from the [Profit] measure.

  1. Click OK. You now have a new measure called "Dynamic Metric."

Step 3: Build a Basic Chart

Let's build a simple view to make sure our parameter and calculated field work correctly.

  1. Create a new worksheet.
  2. Drag Order Date to the Columns shelf. Right-click it and choose "Month (Continuous)".
  3. Drag "Dynamic Metric" to the Rows shelf.
  4. Find your Select a Metric parameter in the Parameters section. Right-click on it and choose Show Parameter.

You should now see a line chart and a dropdown menu on the right side of your screen. Try changing the dropdown from "Sales" to "Profit" — the chart will update automatically! This is the core functionality, but a dropdown isn't a toggle. The next steps will transform this into clickable buttons.

Step 4: Create the "Button" Worksheets

To create a button effect, we’ll build two small, separate worksheets — one for Sales and one for Profit. These will act as our clickable buttons on the dashboard.

  1. Create a new worksheet and name it Sales Button.
  2. Duplicate this worksheet by right-clicking its tab and selecting Duplicate. Rename the copy to Profit Button.

Now you have two sheets that simply display the words "Sales" and "Profit."

Step 5: Assemble the Dashboard

It's time to bring everything together.

  1. Create a new dashboard.
  2. Drag a Horizontal Container onto the canvas.
  3. Drag your Sales Button and Profit Button sheets inside this container, next to each other. Hide the worksheet titles.
  4. Drag your main line chart worksheet onto the dashboard below the container.
  5. On the dashboard view, hide the "Select a Metric" parameter dropdown control you showed earlier (click the 'x'), since our buttons will control it now.

Step 6: Configure Parameter Actions – The Final Touch!

This is where the magic happens. A Dashboard Action tells Tableau to perform an action (like changing a parameter value) when a user interacts with a sheet.

  1. From the top menu, go to Dashboard > Actions...
  2. In the Actions window, click Add Action > Change Parameter...
  3. Configure the first action for the Sales button:
  4. Click OK. You've just told Tableau: "When a user clicks on the Sales Button sheet, pass its value ('Sales') to the target parameter."

Now create a second action for the Profit button:

  1. Again, click Add Action > Change Parameter...
  2. Configure:
  3. Click OK.

Click OK twice to close the action windows. Now, go to your dashboard and click on the "Sales" and "Profit" sheets. Your line chart will update instantly. Congratulations, you've just built an interactive toggle button!

Beyond the Basics: Other Uses for Toggles

Once you understand the concept of using a parameter action to control a calculated field, you can do much more than just swap measures.

  • Toggle Chart Type: Use a parameter to switch between "Bar" and "Line." Create two calculated fields, one for the bar value and one for the line value (the unused one should return NULL). Place both on the Rows shelf, use Dual Axis, and you can toggle between which chart type is visible.
  • Show/Hide Filters or Details (Sheet Swapping): Use a parameter to control a filter that shows or hides an entire worksheet. Place an info sheet and a blank sheet in a vertical container, and use the parameter action to collapse an unselected sheet. This is perfect for creating a clean "pop-up" effect for detailed data tables or filter panes.

Final Thoughts

Creating toggle buttons with parameters and actions transforms your Tableau dashboard from a static report into a dynamic and professional-looking application. It demonstrates the real power of Tableau's interactivity features, and once you have the technique down, you'll find countless ways to use it to enhance user experience.

While mastering tools like Tableau is a valuable skill, getting to the insight is what really matters. If your goal is to get fast, clear answers from your marketing and sales data without a steep learning curve, you'll feel right at home with Graphed. We connect to your data sources and allow you to ask questions in plain English, instantly generating live, interactive dashboards for you. Instead of setting up parameters and actions, you can simply ask, "create a dashboard to compare sales and profit over time," and have it ready in seconds.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.