Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
jsaw
Frequent Visitor

Unnesting Table in Power Query into Rows with same Header

Hello I have a bit of an issue where I have a bunch of nested tables with the same number of rows and only one column, I am trying to make the 1st column into the header and have the nested table as the rows. Calendar Help.png

 

This code worked when I only had two data points (two nested rows) but when I have more or less it breaks at the Table.Transpose step:

 

let

Source = Table.FromColumns({Lines.FromBinary(Web.Contents("Online Calendar"), null, null, 1252)}),

#"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, false), {"Column1.1", "Column1.2"}),

 

#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}}),

 

#"Grouped Rows" = Table.Group(#"Changed Type", {"Column1.1"}, {{"Count", each _, type table [Column1.1=nullable text, Column1.2=nullable text]}}),

 

#"Removed Top Rows" = Table.Skip(#"Grouped Rows",6),

 

#"Removed Bottom Rows" = Table.RemoveLastN(#"Removed Top Rows",3),

 

#"Added Custom" = Table.AddColumn(#"Removed Bottom Rows", "Custom", each Table.Transpose([Count], {"Column1.1", "Column1.2"})),

 

#"Added Custom2" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.CombineColumns([Custom], {"Column1.1", "Column1.2"}, Combiner.CombineTextByDelimiter(":", QuoteStyle.None), "FullName")),

 

#"Removed Other Columns" = Table.SelectColumns(#"Added Custom2",{"Custom.1"}),

 

#"Expanded Custom.1" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom.1", {"FullName"}, {"Custom.1.FullName"}),

 

#"Removed Alternate Rows" = Table.AlternateRows(#"Expanded Custom.1",0,1,1), #"Split Column by Delimiter1" = Table.SplitColumn(#"Removed Alternate Rows", "Custom.1.FullName", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, false), {"Custom.1.FullName.1", "Custom.1.FullName.2"}),

 

#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Custom.1.FullName.1", type text}, {"Custom.1.FullName.2", type text}}),

 

#"Transposed Table" = Table.Transpose(#"Changed Type1"),

 

#"Renamed Columns" = Table.RenameColumns(#"Transposed Table",{{"Column1", "Date"}, {"Column2", "Description"}}),

 

#"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}}) in #"Changed Type2"

2 REPLIES 2
Anonymous
Not applicable

try something like this

 

let
header=table[Column1.1],
valuescols=List.Transform(table[Count], each _[Column1.2]),
tfc=Table.FromColumns(valuecols,header)
in
tfc

 

"table" is your last working step, that in the picture

I am trying to do this in Power Query but it doesn't like me using "header =" because it doesn't recognize it as a function. How would I type this into Power Query? 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.