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
parthpatel4
New Member

Expanding Table to Columns

I am trying to expand the table to columns, but it is not working, how can I do that go through each cell and expand it to columns and skip the cell that has null or blank values. 

parthpatel4_0-1639797817835.pngparthpatel4_1-1639797869163.png

Columns names are consistent everywhere.

 

I tried this code but no luck :

 

 

= Table.ExpandRecordColumn(#"Renamed Columns","Schedule F1", Table.ColumnNames(Table.FromRecords(List.Select(Table.Column(#"Renamed Columns","Schedule F1"), each _<> "" and _<> null))), Table.ColumnNames(Table.FromRecords(List.Select(Table.Column(#"Renamed Columns","Schedule F1"), each _<> "" and _<> null))))

 

 

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @parthpatel4 

 

I guess you probably don't want to filter out rows with blank values, so you can first replace blank values with an empty table which only has column headers "BeginningAmt" and "EndingAmt". Then expand this table column. 

21122102.jpg

let
    Source = Table.FromRecords(  
     {[Name="Bill", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{100,220}})],  
     [Name="Barb", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{120,200}})],  
     [Name="Margo", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{300,400}})],  
     [Name="Jeff", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{300,180}})]},  
type table [  
    Name = text,  
    Schedule F1 = table
]),
    #"Appended Query" = Table.Combine({Source, Query2}),

    // Replace blank values with an empty table
    #"Replaced Value" = Table.ReplaceValue(#"Appended Query","",#table({"BeginningAmt", "EndingAmt"}, {{null,null}}),Replacer.ReplaceValue,{"Schedule F1"}),
    // Expand table column
    Custom1 = Table.ExpandTableColumn(#"Replaced Value", "Schedule F1", {"BeginningAmt", "EndingAmt"}, {"BeginningAmt", "EndingAmt"})
in
    Custom1

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @parthpatel4 

 

I guess you probably don't want to filter out rows with blank values, so you can first replace blank values with an empty table which only has column headers "BeginningAmt" and "EndingAmt". Then expand this table column. 

21122102.jpg

let
    Source = Table.FromRecords(  
     {[Name="Bill", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{100,220}})],  
     [Name="Barb", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{120,200}})],  
     [Name="Margo", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{300,400}})],  
     [Name="Jeff", Schedule F1=#table({"BeginningAmt", "EndingAmt"}, {{300,180}})]},  
type table [  
    Name = text,  
    Schedule F1 = table
]),
    #"Appended Query" = Table.Combine({Source, Query2}),

    // Replace blank values with an empty table
    #"Replaced Value" = Table.ReplaceValue(#"Appended Query","",#table({"BeginningAmt", "EndingAmt"}, {{null,null}}),Replacer.ReplaceValue,{"Schedule F1"}),
    // Expand table column
    Custom1 = Table.ExpandTableColumn(#"Replaced Value", "Schedule F1", {"BeginningAmt", "EndingAmt"}, {"BeginningAmt", "EndingAmt"})
in
    Custom1

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

mahoneypat
Microsoft Employee
Microsoft Employee

You should be able to filter out rows with blank using the drop down filter button.  Also, if each "Table" has a single row (like the other pic suggests), you can add a custom column with an expression like below to extract the first record (and then expand that).

 

= [Schedule T1]{0}

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.