How to Pivot Data and Create Pivot Tables in Tableau

To create a pivot table in Tableau, drag a dimension to the Rows shelf, a second dimension to the Columns shelf, and a measure to the Text mark card. Tableau calls this a crosstab. To reshape wide data first, select columns in the Data Source tab, right-click, and choose Pivot.

  • Key Takeaway 1: Tableau’s Data Source pivot reshapes columns into rows so measures don’t stay buried in separate fields.
  • Key Takeaway 2: A crosstab in Tableau is the closest equivalent to an Excel pivot table, built using Rows, Columns and the Text mark.
  • Key Takeaway 3: Tableau Prep has its own dedicated Pivot step that handles both columns-to-rows and rows-to-columns transformations before the data even hits Desktop.
  • Key Takeaway 4: Unpivoted, wide-format data is one of the most common reasons Tableau charts look wrong on the first attempt.
  • Key Takeaway 5: Data skills like these sit at the core of analyst roles, which LinkedIn ranked among India’s fastest-growing job categories in its 2024 Jobs on the Rise report.

Pivoting vs Crosstabs in Tableau: Two Different Problems

When people ask how to create a pivot table in Tableau, they usually mean one of two things. A pivot in the Data Source is a structural fix: it reshapes your raw data so Tableau can read it cleanly. A crosstab is a view you build in a worksheet: it displays aggregated numbers in a grid, much like a pivot table in Excel.

Most beginners conflate them because Excel’s pivot table does both jobs at once. In Tableau, the workflow is split. You fix the data structure first (pivot), then you build the summary view (crosstab). Getting that order right saves you hours of confusion.

When your data needs a structural pivot

Imagine a sales spreadsheet where each month is its own column: Jan_Sales, Feb_Sales, Mar_Sales. Tableau treats each of those as a separate measure, which makes it nearly impossible to plot a single time-series line chart. You need to pivot those columns into two fields: Month and Sales. That’s the structural pivot, and knowing how to create a pivot table in Tableau starts with recognising when this step is necessary.

This wide-format problem is extremely common with data exported from Indian ERP systems, government portals and legacy MIS tools. If you’ve pulled a report from Tally or an HRMS and it looks like a calendar grid, it almost certainly needs pivoting before you visualise it.

When you need a crosstab instead

If your data is already tidy (one row per observation, one column per variable), you don’t need a structural pivot. You just need to arrange dimensions and measures into a grid view inside Tableau. That’s a crosstab, and it’s the direct answer to how to create a pivot table in Tableau for summary reporting purposes.

Check out our comparison of Power BI vs Tableau if you’re still deciding which tool fits your workflow, since Power BI handles this distinction differently.

How to Create a Pivot Table in Tableau: Pivoting Columns in the Data Source

This is how to do a pivot in Tableau at the data layer. Open Tableau Desktop and connect to your data source. Go to the Data Source tab (the sheet tab at the bottom left, before any worksheets). You’ll see your fields laid out in a grid preview.

Step-by-step: pivot columns to rows in Tableau Desktop

  1. In the Data Source tab, hold Ctrl (Windows) or Cmd (Mac) and click each column you want to collapse into rows. In the sales example, you’d select Jan_Sales, Feb_Sales, Mar_Sales.
  2. Right-click any of the selected column headers and choose Pivot.
  3. Tableau creates two new fields: Pivot Field Names (which will contain “Jan_Sales”, “Feb_Sales”, etc.) and Pivot Field Values (which will contain the actual numbers).
  4. Double-click those generated field names and rename them to something meaningful, like Month and Sales Amount.
  5. Click a worksheet tab. Your newly created fields appear in the Data pane, ready to use.

One practical tip from real project work: always rename the pivot fields immediately. If you leave them as “Pivot Field Names” and “Pivot Field Values”, every colleague who opens the workbook will be confused, and you’ll forget what they mean yourself within a week.

What happens to your original columns

The original wide columns are hidden in the Data Source after pivoting. They’re not deleted from the source file, just excluded from the Tableau extract or live connection. If you need one of them back, you can click the pivot icon in the Data Source tab and remove it from the pivot definition.

Pivot with a live connection vs an extract

Pivoting works with both live connections and extracts, but there’s a catch. With some live database connections (certain SQL sources), Tableau may not support the Data Source pivot and will prompt you to create an extract first. In those cases, create a .hyper extract, then pivot. This is documented in Tableau’s official pivot documentation.

Scenario Pivot Supported? Recommended Action
Excel / CSV file Yes, live Pivot directly in Data Source tab
Google Sheets Yes, live Pivot directly in Data Source tab
MySQL / PostgreSQL Extract only Create .hyper extract first, then pivot
Salesforce / SAP Extract only Use Tableau Prep for cleaner workflow
Tableau Prep output Yes (pre-pivoted) Pivot in Prep before publishing the flow

How to Create a Pivot Table in Tableau: Building a Crosstab

A crosstab in Tableau is a text table that shows aggregated numbers at the intersection of row and column dimensions. It’s the direct answer to how to create a pivot table in Tableau the way Excel users expect. Tableau’s official text table documentation covers the mark type in detail.

Step-by-step: build a crosstab in Tableau Desktop

  1. Open a new worksheet. In the Data pane, drag a dimension (say, Region) to the Rows shelf.
  2. Drag a second dimension (say, Category) to the Columns shelf.
  3. Drag a measure (say, Sales) to the Text mark card. Tableau automatically switches to a text table view.
  4. To add a second measure, drag it onto the Measure Values card. Tableau uses Measure Names and Measure Values as special fields to stack multiple measures in one crosstab.
  5. Format the numbers by right-clicking the measure on the Text card and choosing Format. Set currency, decimal places and alignment there.

If you’re coming from Excel, the mental model is: Rows shelf = row labels, Columns shelf = column labels, Text mark = values area. The logic is identical; only the interface is different.

Adding totals and subtotals

Go to Analysis menu > Totals and choose Show Row Grand Totals or Show Column Grand Totals. For subtotals within a dimension, choose Add All Subtotals. This mirrors Excel’s pivot table totals feature exactly. Tableau calculates these aggregations on the fly, so they update whenever the data refreshes.

Sorting and filtering the crosstab

Click the sort icon on any row or column header to sort ascending or descending. Drag a dimension to the Filters shelf to let users filter the crosstab by product, region, date range or any other field. This is where Tableau’s crosstab starts outperforming a static Excel pivot table, because filters can be published as interactive controls on a dashboard.

If you’re building crosstabs as part of a portfolio, our list of data analytics projects has ideas for structuring real-world datasets that work well in this format.

How to Pivot in Tableau Prep

Tableau Prep Builder is the dedicated data-cleaning tool in the Tableau ecosystem. It has its own Pivot step that’s more powerful than the Data Source pivot in Desktop, because you can pivot mid-flow, preview the transformation visually and combine it with other cleaning steps before the data reaches a worksheet.

How to add a pivot step in Tableau Prep

  1. Open Tableau Prep Builder and connect to your data source. Your fields appear in the Input step.
  2. Click the + icon after any step in the flow and choose Pivot from the menu.
  3. In the Pivot pane, choose Columns to Rows (the most common option) or Rows to Columns if you need to widen the data instead.
  4. Drag the fields you want to collapse from the left panel into the Pivoted Fields section. Prep immediately shows you a preview of the output shape.
  5. Rename the generated Pivot1 Names and Pivot1 Values fields to meaningful names right in the Pivot pane.
  6. Add a Clean step after the Pivot if you need to filter rows, fix data types or handle nulls.
  7. Add an Output step, save as a .hyper file or publish to Tableau Server / Tableau Cloud, then connect Desktop to that output.

The biggest practical advantage of doing the pivot in Prep rather than Desktop is repeatability. When your source data updates monthly, the Prep flow runs again automatically and produces a correctly shaped output every time. You don’t have to remember to re-pivot in the Data Source tab each month.

Rows to columns pivot in Prep

Sometimes you need to go the other direction: you have one row per transaction type, and you want each type as its own column. Choose Rows to Columns in the Pivot pane. Drag the field containing your row labels into the Columns to Pivot on area, and drag the value field into the Values to Aggregate area. Prep creates one new column per unique label value. This is less common but essential for certain reporting formats, especially when feeding data into fixed-column dashboards.

Why pivot before visualising?

Tableau’s calculation engine is optimised for tall, narrow data. Every chart type, from bar charts to scatter plots, expects measures to be in a single column with a label column next to it. Wide data with one column per category fights against that structure at every step. You’ll write more calculated fields, hit more errors and produce charts that are harder to filter and sort. Pivoting first is not optional for clean work; it’s the standard practice among analysts at firms like Infosys, Wipro and TCS who use Tableau for client reporting.

According to NASSCOM’s India Tech Industry Report 2023, data and analytics roles account for over 30% of new tech hiring in India, and Tableau consistently appears among the top five tools listed in those job descriptions. LinkedIn’s 2024 Jobs on the Rise report listed data analyst as one of the top 10 fastest-growing roles globally, with a 25% year-on-year increase in postings in India specifically. According to Gartner’s 2023 Magic Quadrant for Analytics and Business Intelligence Platforms, Tableau holds a market share position among the top two BI platforms globally, with over 1 million active users across enterprise deployments. If you’re building toward one of these roles, understanding the difference between a data analyst vs data scientist will help you decide how deep to go with Tableau versus Python-based data wrangling.

Tools like Tableau are named in the majority of analyst job listings. It’s worth knowing which top data science tools companies use so you prioritise the right skills.

Knowing how to create a pivot table in Tableau also shows up directly in data analyst interview questions. Interviewers at mid-size Indian tech companies frequently ask candidates to reshape a messy dataset and produce a summary table, exactly the workflow this article covers.

Frequently Asked Questions

How do I pivot data in Tableau?

Go to the Data Source tab in Tableau Desktop, select the columns you want to collapse into rows by holding Ctrl and clicking each one, then right-click and choose Pivot. Tableau creates two new fields: one for the original column names and one for the values. Rename both fields immediately to keep your workbook readable. For more control over the transformation, use the dedicated Pivot step in Tableau Prep Builder instead.

Can I create a pivot table in Tableau?

Yes. In Tableau, the equivalent of an Excel pivot table is called a crosstab or text table. You build one by dragging dimensions to the Rows and Columns shelves and a measure to the Text mark card. You can add totals, subtotals and interactive filters, and publish it to a dashboard. It does everything an Excel pivot table does, and the filters work interactively when published to Tableau Server or Tableau Cloud.

What is a crosstab in Tableau?

A crosstab in Tableau is a grid view that shows aggregated measure values at the intersection of row and column dimensions. It uses the Text mark type and relies on Tableau’s Measure Names and Measure Values fields when you include more than one measure. Think of it as a live, filterable summary table that refreshes automatically when the underlying data changes.

How do I pivot in Tableau Prep?

In Tableau Prep Builder, click the + icon after any step in your flow and select Pivot. Choose Columns to Rows or Rows to Columns depending on what your data needs. Drag the relevant fields into the Pivoted Fields area, rename the output fields in the Pivot pane, and add an Output step to save the result. Doing the pivot here means the transformation is baked into a reusable, schedulable flow rather than a one-time manual step in Desktop.

Why pivot data before visualising in Tableau?

Tableau’s visualisation engine expects data in a tall, narrow format where each variable has its own column and each observation has its own row. Wide data with separate columns for each category or time period makes it nearly impossible to build clean charts, because Tableau treats every column as a separate measure. Pivoting first means you write fewer workarounds, your charts filter and sort correctly, and your workbook is easier for teammates to maintain.

You now know how to create a pivot table in Tableau, whether that means reshaping raw data in the Data Source tab, building a crosstab worksheet, or running a Pivot step in Tableau Prep. The next move is to practise with a real dataset so the workflow becomes second nature.

  1. Download a free sample dataset (Tableau’s own Superstore dataset works perfectly) and practise pivoting its monthly columns into a single Date and Sales field this week.
  2. Build a crosstab with Region on Rows, Category on Columns and Sales on Text, then add grand totals and a date filter to see how interactive the view becomes.
  3. Explore the highest paying tech skills for 2026 to see where Tableau fits in the broader analytics job market and plan your next certification accordingly.

Data skills don’t stop at dashboards. Analysts who can clean, reshape and summarise data in Tableau are doing the same cognitive work that SOC analysts do when they filter security logs, build threat dashboards and spot anomalies in real time. If that direction interests you, look at the EC-Council Certified SOC Analyst course at 3.0 University, where practical data thinking meets cybersecurity. You can browse the full catalogue of certification programmes in Cybersecurity, AI, Blockchain and Web3 at 3.0 University online certification courses.

Last updated: October 2026. Reviewed by the 3University editorial team.

We create, review, and maintain educational content covering Cybersecurity, Ethical Hacking, Artificial Intelligence, Blockchain, Web3, and emerging technologies.

Read More Articles