Forum

Notifications
Clear all

4.17 Unpivot

6 Posts
3 Users
0 Reactions
85 Views
(@kengjisugmail-com)
Posts: 8
Active Member
Topic starter
 

When I try to Unpivot the attached Table it does not align the values as expected. Am I missing a step? Or will I need to create 2 separate queries and append?

 
Posted : 04/06/2016 11:58 am
(@mynda)
Posts: 4762
Member Admin
 

Hi Moavu,

Please attach a file with your attempt so I can see where things might be going wrong.

Mynda

 
Posted : 04/06/2016 10:09 pm
(@alexb)
Posts: 2
New Member
 

Hello Moavu,

I thought I could use some practice myself, is the attached what you are expecting ?

If so all I did was select columns A & B and then ran Transform > Unpivot > Unpivot Other Columns.

Alternatively select the other (value) columns and Unpivot Columns.

PS: I also split the year out of the heading text into a separate column

 

Alex

 
Posted : 04/06/2016 11:39 pm
(@kengjisugmail-com)
Posts: 8
Active Member
Topic starter
 

Hello Alex,

I tried that before.

May be I was not very clear, the result I am looking for is 5 columns

one for Sales, Sales out, Year, Cat and Product.

I have created two separate queries and merged them and it works.

Is there a way to do it in one query?

I have attached my starting to end position.

 

Thanks,

 

Moavu

 
Posted : 05/06/2016 6:38 am
(@alexb)
Posts: 2
New Member
 

Hello again Moavu,

Since what I sent you is a fully unpivoted version, you can simply use Power Query's "Pivot function" to swing the column that had the Sales / Sales out attribute in it, back to being columns.

I did it by selecting that Attribute column, invoking Transform > Pivot, selecting the Value column from the drop down box in the dialogue box.

See if the attached is how you wanted to finish up.  I added a Notes sheet with a screen shot of the Pivot dialogue box.

 
Posted : 06/06/2016 12:32 am
(@kengjisugmail-com)
Posts: 8
Active Member
Topic starter
 

Hi Alex,

 

Many thanks,

 

It worked. I was missing out the step of splitting the column with Sales and Sales out.

Thanks once more.

 

Moavu

 
Posted : 07/06/2016 6:57 am
Share: