Power BI Unpivot table option converts selected columns into rows. Let us see how to create an Unpivot table or how to convert the pivot table with an example.
How to create unpivot Table in Power BI
Please click the Edit Queries option under the Home tab to create or convert the pivot to unpivot table.
Clicking the Edit Queries option opens a new window called the Power BI Power Query Editor.
In this example, we are going to perform on the columns 2005, 2006, 2006, and 2007.
There are a couple of ways to this
The First approach to unpivot table in Power BI
Please select the columns that you don’t want to unpivot, or you want to keep unchanged will open the context menu. Select the Unpivot Other Columns option. This will perform on all the fields except the selected ones.
Now you can see the unpivoted table.
The second approach to unpivot table in Power BI
Please select the columns you want to use and right-click on them to open the context menu. Next, select the Unpivot Only Selected Columns option. And this option will do on all the selected columns.
Now you can see the unpivoted table
The third approach
In order to convert the pivot table, go to Transform Tab. Under this tab, you can find the Unpivot Column button, as shown below.
Use the drop-down list to perform this operation. We selected the Product ID and Name fields for demonstration purposes and then set the Unpivot Other columns option.
Now you can see the Power BI unpivot table.
We renamed the cols to more meaningful ones. Next, hit the Close & Apply option under the Home tab to apply these changes.
From the screenshot below, you can see those columns on the right side.
Unpivot transfers the columns into attributes and values, which means converting columns to rows. All the column names become row fields, and the associated numbers become values of the corresponding row.
Attribute – Column Names
Values – The values under Attribute column names.
There are multiple ways to unpivot in Power Query. The first is selecting the columns and right-clicking them to open the context menu. Here, choose either of the three options. The second approach is to go to the Transform tab and use the Unpivot columns option.
Pivot converts rows into columns, whereas unpivot does the reverse; it converts columns to rows.
By using the Ctrl, select the number of columns you want to perform, and right-click on any will open the menu. Next, choose the Unpivot Columns or the only selected option.