Forum Discussion
LukeReds
2 years agoHelper II
Transform an horizontal table in vertical (3 columns) with Power Query
Hi to everyone, I have a table like the one in the image above, every year there will be 3 new columns (name, description and a date), i need to trasform this table like the one below, only 3 column...
- 2 years ago
Hi LukeReds
Give this a go. It assumes the same set of three columns is repeated in the exact same order.
let Source = YourTable, Split = Table.Combine( List.Transform( List.Split( Table.ColumnNames(Source), 3 ), each [ t = Table.SelectColumns(Source, _), v = List.Last( Table.ColumnNames(t)), r = Table.FromColumns( List.RemoveLastN( Table.ToColumns(t), 1) & {List.Repeat( {v}, Table.RowCount(t))}, {"Name", "Description", "Date"} ) ][r] ) ) in Splitwith this result
I hope this is helpful