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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.