How to Create a Pivot Table in Tableau

Cody Schneider7 min read

If you're coming from an Excel background, pivot tables are likely your go-to tool for summarizing data. In Tableau, the concept is a bit different but even more powerful. This guide will walk you through exactly how to pivot your data in Tableau to make it flexible, analyzable, and ready for stunning visualizations.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Why Do You Need to "Pivot" Data in Tableau?

In the world of spreadsheets, a pivot table is something you create to summarize raw data. In Tableau, "pivoting" is a data preparation step you perform on your source file itself. It’s the process of changing your data’s structure from a wide format to a tall format.

Let's look at a common example. Imagine your data looks like this, with sales broken out by month in separate columns:

Product | Region | Jan_Sales | Feb_Sales | Mar_Sales
-------------------------------------------------------
Gadget A| North  | 1000      | 1200      | 1150
Widget B| North  | 800       | 850       | 900
Gadget A| South  | 1500      | 1400      | 1600

This is a "wide" format. It's easy for a human to read, but it’s difficult for Tableau to analyze over time. For instance, creating a single line chart showing the sales trend from January to March would be clunky. You'd have to work with three separate measures (Jan_Sales, Feb_Sales, Mar_Sales), which is inefficient.

Tableau works best with "tall" data, which would look like this:

Product | Region | Month     | Sales
----------------------------------------
Gadget A| North  | Jan_Sales | 1000
Gadget A| North  | Feb_Sales | 1200
Gadget A| North  | Mar_Sales | 1150
Widget B| North  | Jan_Sales | 800
...and so on.

Pivoting your data transforms it into this "tall" structure. Now, you have one dimension for "Month" and one measure for "Sales." This is far more flexible and lets you build visualizations with drag-and-drop ease.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Step-by-Step: How to Pivot Your Data in Tableau

Pivoting data is done on the Data Source page right after you connect to your data. It's very straightforward once you know where to look. Let’s walk through the process using our sales example.

1. Connect to Your Data Source

First, open Tableau and connect to your data file. This pivot function works best with file-based sources like Microsoft Excel, text files (.csv), and Google Sheets.

  • On the start screen, under "Connect," choose the file type you're using (e.g., "Microsoft Excel").
  • Locate and select your file to open it.

Tableau will load the data and show you a preview of your columns on the Data Source page.

2. Identify the Columns to Pivot

Look at your data preview. You need to identify all the columns that you want to un-pivot into rows. In our example, these are the individual month columns: Jan_Sales, Feb_Sales, and Mar_Sales.

The columns you don't select, like Product and Region, will remain as they are, repeated for each new row that is created.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

3. Select and Pivot the Columns

Now for the main step. In the data preview grid on the Data Source page, select the columns you want to pivot.

  • Click on the first column header, Jan_Sales.
  • Hold down the Shift key and click on the last column header, Mar_Sales. This will select all three columns. (Alternatively, you can hold down the Ctrl (or Command on Mac) key to select multiple individual columns that aren't next to each other).
  • Once your columns are highlighted, right-click on any of the highlighted column headers.
  • From the context menu, select Pivot.

Instantly, you will see your data structure change in the preview grid. Your three sales columns will disappear and be replaced by two new columns.

4. Rename Your New Pivot Columns

Tableau gives your newly created columns generic names: "Pivot Field Names" and "Pivot Field Values." These aren’t very descriptive, so you should always rename them to something meaningful.

  • The "Pivot Field Names" column will contain the original headers (Jan_Sales, Feb_Sales, etc.). This should be renamed to describe what those headers represent. Let's call it "Month". To rename it, right-click the "Pivot Field Names" header and select "Rename".
  • The "Pivot Field Values" column contains the actual data from the cells (the sales numbers). This is your new measure. Let's rename it to "Sales Amount".

Your data is now properly structured and ready for analysis!

Troubleshooting: I Don't See the "Pivot" Option!

Sometimes you might right-click and find that the "Pivot" option is grayed out or missing entirely. This is a common point of confusion and usually happens for one of a few reasons:

  • Unsupported Data Sources: The native pivot function in the Data Source pane is only available for certain data source types. It generally works for non-relational, file-based sources like Excel, CSVs, and Google Sheets. If you have a live connection to a relational database like SQL Server, Microsoft SQL, Oracle, or connecting to a published Tableau Data Source, the option won't be there.
  • You're in the Wrong Place: Remember, pivoting is done on the Data Source page (the first screen after connecting to your data), not within a worksheet after you've already started building a viz.

What are the workarounds?

If you're using an unsupported data source, you'll need to do the data transformation before it gets to the worksheet. Your best options are:

  • Tableau Prep: This tool is specifically designed for cleaning and structuring data. Tableau Prep has a powerful and visual pivot step that can handle this task for any data source.
  • Custom SQL: If you're comfortable with SQL, you can use a UNION ALL statement to manually 'unpivot' the data as you connect to it in Tableau. This is more advanced but highly effective.
GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Building a "Pivot Table" View After Pivoting Your Data

Now that your data is in the proper "tall" format, building a view that resembles a traditional Excel pivot table (also known as a crosstab in Tableau) is incredibly simple.

Navigate to a new sheet by clicking the "Sheet 1" tab.

  1. Your newly created fields, "Month" and "Sales Amount," will appear in the Data pane on the left. "Month" will be under Dimensions, and "Sales Amount" will be under Measures.
  2. Drag the Product dimension to the Rows shelf.
  3. Drag your new Month dimension to the Columns shelf.
  4. Finally, drag your new Sales Amount measure onto the Text mark in the Marks card.

And there you have it! Tableau automatically creates a text table that looks just like a pivot table, showing the sales amount for each product, broken down by month. The best part is that this view is now incredibly flexible. With a single click, you can transform this text table into a side-by-side bar chart, a heatmap, or a line chart – all because you took a moment to pivot your data correctly from the start.

Final Thoughts

Pivoting data is a fundamental preparation step in Tableau that transforms your dataset from a wide, human-readable format to a tall, analysis-friendly structure. By understanding how to select, pivot, and rename your columns on the Data Source page, you unlock far more flexibility for creating insightful comparisons and visualizations effortlessly.

While pivoting within Tableau is powerful, the reality is that preparing data still involves a lot of manual work, especially when your data lives in different places like Shopify, Google Analytics, and Facebook Ads. We built Graphed because we believe valuable time shouldn't be lost to data prep. Instead of connecting CSVs or manually structuring columns, you can connect your platforms and simply ask for the dashboard you need. Graphed handles the tough data wrangling in the background, so you get straight to the insights pulled from live, connected data.

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!