top of page

Creating a Dynamic Bar Chart in Tableau with Parameters and Calculated Fields

Updated: May 29

In this Tableau tutorial, you’ll learn how to use parameters and calculated fields to create a dynamic bar chart. This chart allows users to switch between different dimensions — Segment, Region, or Ship Mode — with a simple dropdown.


This powerful technique adds flexibility and interactivity to your dashboards. Best of all, it eliminates the need for multiple charts or worksheets, saving you time and complexity.


We’ll use Tableau’s popular Global Superstore dataset to plot Sales against the dimension selected by the user.


Download the dataset here:


🛠️ Step-by-Step Guide: Build a Dynamic Bar Chart in Tableau


🔸 Step 1: Create a Parameter

  1. Right-click in the Data pane and select Create Parameter.

  2. Name it: Choose Dimensions.

  3. Set Data Type to String.

  4. Allowable values should be set to: List.

  5. Add the following values:

    • Segment

    • Region

    • Ship Mode

  6. Click OK.

  7. Right-click the parameter and select Show Parameter.


🔸 Step 2: Create a Calculated Field

  1. Right-click in the Data pane and select Create Calculated Field.

  2. Name it: Chosen Dimension.

  3. Use the following CASE statement to configure it:


Here’s the snippet you can use:

```plaintext

CASE [Choose Dimensions]

WHEN 'Segment' THEN [Segment]

WHEN 'Region' THEN [Region]

WHEN 'Ship Mode' THEN [Ship Mode]

END

```

  1. Click OK.

  2. Right-click on the newly created parameter and select Show Parameter. The parameter will then appear on the left side of the canvas.


🔸 Step 3: Build the Dynamic Bar Chart

  1. Drag Chosen Dimension to the Columns.

  2. Drag Sales to the Rows.

  3. Sort the chart in descending order for better readability.

  4. You can add color, labels, or tooltips as needed for additional context and clarity.


💡 Tip: Visibility Matters

Make sure the parameter control is visible on your dashboard. This allows users to switch between dimensions interactively, enhancing their experience.


Benefits of This Method


Utilizing parameters and calculated fields to create a dynamic bar chart offers several advantages:


  • Cleaner Dashboards: You won’t need multiple worksheets to display various dimensions. It simplifies your dashboard design.

  • Interactive User Experience: Users have greater control over what they see. They can switch dimensions at their convenience, making data exploration easier.

  • Scalable Design: If you need to add more dimensions later, it’s simple to do. The existing setup will accommodate new data points without hassle.


🎥 Want to See It in Action?

Check out our step-by-step video tutorial here: 👈 Watch on YouTube



Keep Learning with Think Data with Tableau


This tutorial is just one among many practical Tableau skills you can learn here. Follow the Think Data with Tableau blog and YouTube channel for more follow-along tutorials and dashboard inspiration.


Was this blog Insightful/Helpful? Please cast your vote


Was this Insightful / Helpful?

  • Yes

  • No


Comments


bottom of page