Pivot consists of transforming columns into lines. In this example, we want to pivot the four columns with the different years into two columns: one for the name of the year and one for the value.
To do that, follow these steps:
- Select all the years' columns to pivot (click on them while pressing Ctrl (Windows) or command (macOS)).
- Right-click on the last selected one and select Pivot, as highlighted here:
The result of the pivot is two columns:
- One Dimension: Pivot Field Names
- One Measure: Pivot Field Values
You can rename them to Year and Values, respectively.
The transformations are complete. You have a clean and simple Data Source. Here's the result:
As you can see, you can even use Tableau to clean your data very quickly!