Forum

Unpivot other colum...
 
Notifications
Clear all

Unpivot other columns in one column table and keep the column

2 Posts
2 Users
0 Reactions
75 Views
(@jaryszek)
Posts: 177
Reputable Member
Topic starter
 

Hello,

i have the source table:

Name

HotSummerInBerlin

and now using query:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")
in
#"Unpivoted Columns"

How can i keep column from source table? 

The result should be:

 

Name|Attribute|Value

HotSummerInBerlin Name HotSummerInBerlin

 

Best,
Jacek

 
Posted : 18/06/2021 5:54 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Jacek,

Add a custom column with this formula:

= Source

Expand the column to reveal the Name again.

Here is the code:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
#"Added Custom" = Table.AddColumn(#"Unpivoted Columns", "Custom", each Source),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Name"}, {"Name"})
in
#"Expanded Custom"

 

Mynda

 
Posted : 20/06/2021 12:35 am
Share: