How to Pivot Columns in Tableau : Bijay Kumar

How to Pivot Columns in Tableau
by: Bijay Kumar
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of the Content In this tutorial, the author explains how to effectively pivot data in Tableau to create better-structured reports. The main idea is that data is often presented in multiple columns (e.g., sales, profit) but is easier to analyze when it is in a long format. This format typically has one column for the type of data (like Month or Measure) and another for the values. **Key Steps in Pivoting Data:** 1. **Understanding Pivoting:** Pivoting in Tableau involves converting columns into rows, allowing for a more streamlined analysis. For instance, instead of having separate columns for Sales, Profit, and Discounts, you can consolidate them into a single column for better comparison. 2. **Creating Pivot Tables for Measures:** - Connect to your dataset. - Select the measure columns you want to pivot (like Sales, Profit, and Discount). - Right-click and choose "Pivot" to create two new columns: Pivot Field Names and Pivot Field Values. - You can then visualize this data in a new worksheet. 3. **Creating Pivot Tables for Time-Based Data:** - Similar to measures, you can pivot columns that represent different time periods (like Sales for 2022, 2023, and 2024). - After pivoting, you can visualize trends over the years and compare sales across categories. **Conclusion:** Pivot tables in Tableau help reshape and analyze data effectively, allowing for easier visual comparisons and trend analysis. ### Additional Context Pivoting is a crucial technique in data analysis as it simplifies the data structure, making it easier to derive insights and create visualizations. This method is particularly useful when dealing with large datasets where multiple metrics or time periods are involved. ### Relevant Hashtags for SEO #Tableau #DataVisualization #DataAnalysis #PivotTables #TableauTutorial #BusinessIntelligence #DataScience #Analytics #DataPivoting #TableauTips


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, like Month or Measure, and another contains the corresponding values.

To convert such data into long format, we can group them using the pivot feature in Tableau.

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

What is Pivoting in Tableau?

In Tableau, pivoting means turning columns into rows to make the data more suitable for analysis. For example, instead of having separate columns for Sales, Profit, Quantity, and Discount, we can pivot them into a single column called Measure Type and another column called Measure Value.

By using the Pivot table in Tableau, we can you can group, count, or total values without changing the original data in the source.

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 we will pivot values for time-based columns like 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 setting the connection with the dataset, click on 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 to Rows, Measure Type to Columns and Measure Value to Text or Label card.

Now, in the view, we can see the summary of records showing all the measures per category that are generated from one 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 the related metrics into one field, we can build side-by-side visual comparisons and simplify calculations and filters in Tableau visualisation.

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.

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:

The post How to Pivot Columns in Tableau appeared first on SalesForce FAQs.


October 10, 2025 at 11:54PM
Click here for more details...

=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce