top of page

How to Pivot Your Data

Did you know you can pivot your data in Tableau? Do you have a data source that has multiple columns? Depending on how your data is structured it may be better to pivot your data into a tall data format instead of a wide one. Tableau will run faster with tall data versus wide data.


For more information on Tableau Pivot data refer to this help link.


In the example below I have a wide data set that has columns with Profit, Quarter and Year as well as Sales, Quarter and Year.


Please note: I can only perform a pivot once to my data.

In order to pivot this data set, I select the first column Profit Q1 2014 and then scroll over all the way to the right (while holding my shift key down) to select the last column.


This action should highlight all of the columns. I then right-click on one of them and select Pivot from the drop-down menu.


This will transform all of the columns into rows. The text in the Sub-Category column will have duplicate for every row that was previously a column.


I can rename the Pivot Field Names and Pivot Field Values columns.

I can also create a calculated field to separate the metric, quarter and year values.


Metric

LEFT([Pivot Field Names],6)


Quarter

LEFT(Right([Pivot Field Names],7),2)


Year

Right([Pivot Field Names],4)


Here is a print screen of the data transformed in a worksheet.





191 views0 comments

Comments


bottom of page