Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Not applicable

Pivot/Unpivot Power Query

Hello I have my source in a similar format as the picture below;


The format that I want to switch this to is have the months in one column and have 2 seperate columns for 2018 and 2019 sales.


Thanks in advance

Frequent Visitor


In my opinion its always better to transform the input table to row level and use visuals to get de desired result. I made a sample .pbix with both the transformation to row level and the desired table. U can download the file here: 

To get to the row level I first Transposed the table. Then I removed 'Sales' from the year column (not necessary). Ater that I Promoted the first row to headers and renamed them. After that I selected the product columns and unpivoted them to get to row level ('Convert to Rows' table in file).  Within the report I made a Matix that shows the desired result.


To get the result using Power Query after the row level there is one more stap ('Option 2' table in file). That is to select the Year column and then choose Pivot and select 'sales' as Value Column. By default the Aggregate function is SUM.

Hope this is useful.



Community Support
Community Support



You can unpivot the column 2018 1 sales - 2019 12 sales to row data like picture below. Renamed the new column .Or could you please share your sample data or desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.


For example:


Best Regards,



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not applicable

Thank you for the help,

Yeah I realized I wasn't very clear with my question.  Basically I have different monthly data in columns like 2018 Jan sales, 2018 Feb sales, ... 2019 Jan sales, 2019 Feb sales, ... and I wanna have the months in one column and have 2 columns for 2018 sales and 2019 sales like this;


I tried to unpivot the first 12 column and then the other 12 column but it doesnt work.


Thanks again

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors