Forum Discussion
Anonymous
7 years agoNot applicable
Transform Data Table - Extract Data from Existing Column and Return New Column
Hello Community, I am new to Power Query and am trying to use some of my existing data to create a modified version of it. I would like to use my existing table to create a new column (or new table...
- 7 years ago
you can use Merge for that, merging with current table, with following joins (you add second and more joins by clicking on a column with Ctrl pressed):
you can then expand the relevant column and rename it properly
you can also see how it works with this M query
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Pc3LDcAwCAPQXThzKKH5zYKy/xoB6nJwFD1Z2IyEuLI8jQ6bv5wJHaXqP4XO0heS/ScrwR2ULMUDN4J36cQNxZ6kLvQUe59uiP57zucC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Index = _t, ATD = _t, #"run id" = _t, #"data 1" = _t, #"Ref id" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"ATD", Int64.Type}, {"run id", Int64.Type}, {"data 1", Int64.Type}, {"Ref id", Int64.Type}}), #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Ref id", "ATD"}, #"Changed Type", {"run id", "ATD"}, "Changed Type", JoinKind.LeftOuter), #"Expanded Changed Type" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type", {"data 1"}, {"Changed Type.data 1"}), #"Renamed Columns" = Table.RenameColumns(#"Expanded Changed Type",{{"Changed Type.data 1", "Ref data"}}) in #"Renamed Columns"
Stachu
Community Champion
7 years agoyou can use Merge for that, merging with current table, with following joins (you add second and more joins by clicking on a column with Ctrl pressed):
you can then expand the relevant column and rename it properly
you can also see how it works with this M query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Pc3LDcAwCAPQXThzKKH5zYKy/xoB6nJwFD1Z2IyEuLI8jQ6bv5wJHaXqP4XO0heS/ScrwR2ULMUDN4J36cQNxZ6kLvQUe59uiP57zucC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Index = _t, ATD = _t, #"run id" = _t, #"data 1" = _t, #"Ref id" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"ATD", Int64.Type}, {"run id", Int64.Type}, {"data 1", Int64.Type}, {"Ref id", Int64.Type}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Ref id", "ATD"}, #"Changed Type", {"run id", "ATD"}, "Changed Type", JoinKind.LeftOuter),
#"Expanded Changed Type" = Table.ExpandTableColumn(#"Merged Queries", "Changed Type", {"data 1"}, {"Changed Type.data 1"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Changed Type",{{"Changed Type.data 1", "Ref data"}})
in
#"Renamed Columns"- Anonymous7 years agoNot applicable
Stachu ,
Thanks for the help, this is what I was looking for.