Forum

Unpivot data in Pow...
 
Notifications
Clear all

Unpivot data in Power Query

5 Posts
4 Users
0 Reactions
91 Views
(@pritch01)
Posts: 8
Active Member
Topic starter
 

I have a 2-column table, one column is labeled Headings and the other Values.

I am trying to move the 5 unique references in the Heading column into 5 separate columns and the data in the Values column moved under the appropriate heading.

Attached I have added a sample.

 

Thanks

P

 
Posted : 21/03/2023 9:14 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

hi Paul,

No file attached.  Click Start Upload after selecting the file.

regards

Phil

 
Posted : 21/03/2023 9:54 pm
(@mynda)
Posts: 4761
Member Admin
 

Sounds like you need to Pivot the data. Select the Heading column > Transform tab > Pivot Column. Select the Values column from the drop down and under Advanced Options, select 'don't aggregate'.

If that's not what you need, then please upload the example file showing before and after examples.

Mynda

 
Posted : 21/03/2023 9:58 pm
(@pritch01)
Posts: 8
Active Member
Topic starter
 

Hi Mynda

Thanks for your reply, see attached the file - sorry I thought I had attached in the original post.

The pivot worked however it returned an error, see attached the original sample and error

Thanks

PaulPivot-Query.jpg

 
Posted : 21/03/2023 10:26 pm
(@debaser)
Posts: 836
Member Moderator
 

Specify an action for the values column (eg Sum). The formula should look like:

 

= Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Headings]), "Headings", "Values", List.Sum)

 

for example.

 
Posted : 22/03/2023 4:37 am
Share: