Pivot Column Question

Craigc3814

Board Regular
Joined
Mar 7, 2016
Messages
217
I assume this is a very easy thing to do and I am just missing what I want for some reason. I am using PowerQuery and Excel 2016 (Office 365)

I have 5 columns of data that look like below

Location Usage Date BMD IMD PMD
Home January 50 100 100
Home February 75 80 80


I want to transform (I assume Pivot with no aggregation) to this

Location Type January February March April......
Home BMD 50 75
Home IMD 100 80
Home PMD 100 80
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
if this is your source data (blue table)

Location_UsageDateBMDIMDPMDLocation_UsageAttributeJanuaryFebruary
HomeJanuary
50​
100​
100​
HomeBMD
50​
75​
HomeFebruary
75​
80​
80​
HomeIMD
100​
80​
HomePMD
100​
80​



Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Location_Usage", type text}, {"Date", type text}, {"BMD", Int64.Type}, {"IMD", Int64.Type}, {"PMD", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date", "Location_Usage"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Date]), "Date", "Value", List.Sum)
in
    #"Pivoted Column"[/SIZE]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,228
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top