How to Pivot Columns in Tableau

While creating reports in Tableau, I get the data that is divided into multiple columns, for example, separate columns for sales, profit, or different time periods.

In Tableau, reports are better structured when the data is in a long format. In this format, one column defines the type, such as Month or Measure, and another column contains the corresponding values.

To convert such data into long format, we can use Tableau’s pivot feature to group it.

In this Tableau tutorial, I’ll explain how to pivot data in Tableau. In this, we will see two common use cases: pivoting measures and pivoting time-based data.

What “Pivot Columns” Means in Tableau

When I say “pivot columns in Tableau,” I’m talking about reshaping your data so it’s easier to analyze and build charts from.

There are two main scenarios:

  • Columns to rows (unpivot): You have many similar columns (Jan, Feb, Mar…) and you want to stack them into a single column (Month) with another column for values (Sales). This is the most common pivot in Tableau Desktop.
  • Rows to columns: You have “tall” data (one row per combination of dimension and value), and you want separate columns for each category (for example, separate columns for each order status). This is usually done in Tableau Prep or via other tools before data reaches Desktop.

Why You Should Pivot Columns in Tableau

Let me quickly explain why pivoting is worth your time. In most real‑world data, you’ll see structures like this:

  • One column per month (Jan, Feb, Mar…)
  • One column per survey question (Q1, Q2, Q3…)
  • One column per product or region (Product A, Product B…)

This layout is convenient in Excel, but it’s not great for Tableau. It usually causes issues like:

  • You struggle to build flexible charts because each month or question is a separate field.
  • You can’t easily add a filter for “Month” or “Question” because that concept isn’t a single field.
  • You need lots of manual steps (multiple calculated fields, manual color assignments, etc.).

After pivoting:

  • You get one column that represents the category (Month, Question, Region…).
  • You get one column that represents the value (Sales, Response, Amount…).
  • Your data becomes “tidy,” and most Tableau visuals become much easier to build.

So if you ever feel like you have “too many similar columns,” pivoting is usually the fix.

Create Pivot Tables in Tableau

In the examples below, we will create the pivot tables in Tableau. In these, we will see how to pivot fields for measures, and then pivot values for time-based columns such as Year, Month, and Quarter.

Create a Pivot Table for Measure Columns in Tableau

In this example, we will pivot the measure columns like Sales, Profit, and Discount from the Tableau Superstore dataset.

Now, connect Tableau with the Superstore dataset and follow the steps below.

  1. After establishing the connection to the dataset, click the Data source tab.
  1. In the Data Source, we will see the data table. Here, press “Ctrl” and select the Measures that you want to pivot. In this example, we will pivot the Sales, Profit, and Discount.
  1. Right-click on one of the selected headers and select Pivot.
How to Pivot fields in tableau

As we click on the Pivot, the selected measures will be pivoted, creating two columns, Pivot Field Names and Pivot Field Values.

Create Pivot Fields in Tableau
  1. To edit the pivoted field names, click on the column header and enter the label.
Add Label to pivoted table in Tableau
  1. To visualise the data using the pivoted fields, open a new worksheet and add Category toRows, Measure Type to Columns, and Measure Value to Text or Label card.

Now, in the view, we can see a summary of records showing all measures per category generated from a single pivoted field.

Pivot field columns in Tableau
  1. To remove the label of the Pivoted field, click on the table and select Hide Field Labels for Columns.
Hide Field labels in Pivoted table

This way, we can pivot the measure fields in Tableau and visualise the data from multiple measures in a single pivoted column.

By pivoting related metrics into a single field, we can build side-by-side visual comparisons and simplify calculations and filters in Tableau visualisations.

Create a Pivoted Table for Time-Based Columns

In this method, we will create a pivoted table for the time-based column fields such as Year, Quarter, and Month.

In Tableau, the dataset might have separate columns for different time periods, such as 2022 Sales, 2023 Sales, and 2024 Sales.

Instead of having a separate Sales column for each column, we can pivot and convert them into a time-based structure.

For this data visualisation, I have created a sample dataset where the Category field has the product category. Then we have measures Sales 2022, Sales 2023 and Sales 2024 to show sales for each category in a specific year.

Pivot table for date fields

Now connect this dataset with Tableau and follow the steps below.

  1. In the Tableau, click on the Data Source tab.
  1. In the data table, press “Ctrl” and select the date field columns.
  1. Click on the dropdown of any of the selected columns and select Pivot.
Pivot date fields in Tableau
  1. Now, rename the pivoted measure names to Years and the pivoted values to Sales.
Pivoted data table in Tableau
  1. To create the view, add the Years to Columns and Sales to Rows. After this, add the Category dimension to the Colour card.
Pivoting in tableau date fields

In this view, we will see a trend line comparing yearly sales across different categories, which was not possible before pivoting.

This way, we can create a pivoted table for time-based or date-related columns.

How to Undo or Adjust a Pivot

Sometimes you pivot the wrong columns or realize you missed something. Here’s how to fix it.

Undo immediately

If you just pivoted and want to revert it:

  • Press Ctrl+Z (Cmd+Z on Mac).
  • Or click the “Undo” arrow at the top left.

This will take you back to the original table.

Remove a pivot later

If you’ve done additional steps and undo is not convenient:

  • On the Data Source page, look at the left side where the tables and joins show.
  • You’ll see a “Pivot” step in the logical flow.
  • Click the drop‑down arrow beside that pivot step and choose “Remove” to delete the pivot.

After removing the pivot, your data goes back to its original wide format.

Add or remove columns from an existing pivot

If you forgot to include a column in the pivot:

  1. On the Data Source page, find that column in the grid or in the field list on the left.
  2. Drag it into the existing pivot area (where Pivot Field Names / Pivot Field Values are).
  3. Tableau adds that column into the pivot operation.

If you accidentally included a column in the pivot:

  • In the pivot area, click the drop‑down on the field and remove it from the pivot.

This is handy when you have many columns, and you don’t want to redo everything from scratch.

When You Should Not Pivot in Tablue

Pivoting is powerful, but you don’t always need it. I usually avoid pivoting when:

  • Each column truly represents a different concept
    For example, “CustomerName,” “OrderDate,” and “OrderAmount” should obviously stay as separate columns.
  • You only have a few columns and don’t need flexibility
    If you have just two or three measure columns and very simple reporting needs, keeping them separate might be fine.
  • Your data model or downstream systems expect the wide format
    If other tools or teams rely on the wide layout, don’t change it lightly. In that case, consider creating a separate, pivoted version just for your Tableau dashboards.

Conclusion

In this Tableau tutorial, we learned how useful pivot tables are for reshaping and analysing data.

In the above examples, we have pivoted the columns like Sales, Profit, Quantity, and Discount or even year-based columns. By using this, we can easily create visuals that show trends, comparisons, and patterns. Instead of handling multiple separate columns, all related data gets organised under one field, making analysis simpler.

You may also like to read:

live webinar

Salesforce Data Cloud with Agentforce Data Library

In this live webinar, we will showcase how Salesforce AI Agents use business data and documents to provide intelligent responses using Agentforce Data Library and Salesforce Data Cloud.

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.