Forum Discussion
Pawel_Sz
Sep 21, 2023Copper Contributor
Power Query Spliting table with multiple columns into rows based on col1
Hi All, I bet this is a simple thing, but I can't find the answer to it and my search does't get me the proper response. I need to change the source table A Project Dependency 1 Dependency...
- Sep 21, 2023
SergeiBaklan
Sep 22, 2023MVP
As variant
let
Source = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
names = { "Dependency" ,"Dependency Date"},
combineDependency = Table.SelectColumns( Table.AddColumn(
Source,
"Data",
each #table( names,
List.Zip( {
List.RemoveNulls( List.Alternate( Record.FieldValues(_), 1, 1 ) ),
List.RemoveNulls( List.Alternate( List.Skip( Record.FieldValues(_) ), 1, 1 ) )
} )
), type table [Dependency = text, #"Dependency Date" = date] ),
{"Project", "Data"} ),
expandDependency = Table.ExpandTableColumn(
combineDependency,
"Data", names, names ),
declareType = Table.TransformColumnTypes(
expandDependency,
{
{"Project", type text},
{"Dependency Date", type date}
})
in
declareType
- Pawel_SzSep 25, 2023Copper ContributorHi Sergei,
that one is also a super interesting alternative (also extra 10pts to you on making my brain get deeper into M-language). Many thanks!
After playing around with Oliver's I looked into yours and also came across sth on YT which made my eyes open broader wrt your approach.- SergeiBaklanSep 25, 2023MVP
Pawel_Sz you are welcome. As usual each task could be done by several ways, use one which is more suitable for you.