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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
joshuac055
Frequent Visitor

Expand all Columns in a Table at once

I need to expand each one of these columns that each represents a file, but it will take forever to do that. Is there a way to expand all of these columns at once?

joshuac055_0-1719418420601.png

 

 

2 REPLIES 2
dufoq3
Super User
Super User

Hi @joshuac055, check this:

 

let
    TableA = #table({"4/4/24", "4/11/24", "4/18/24"}, {
        {#table({"A", "B"}, {{1,2}, {3,4}}),
        #table({"A", "B", "C"}, {{5,6,7}, {8,9,10}}),
        #table({"D", "E"}, {{15,16}, {17,18}})}
    }),
    Ad_Helper = Table.AddColumn(TableA, "Helper", each 1, Int64.Type),
    UnpivotedOtherColumns = Table.UnpivotOtherColumns(Ad_Helper, {"Helper"}, "Date", "Table"),
    Ad_ColNames = Table.AddColumn(UnpivotedOtherColumns, "ColNames", each Table.ColumnNames([Table]), type list),
    ExpandedTable = Table.ExpandTableColumn(Ad_ColNames, "Table", List.Distinct(List.Combine(Ad_ColNames[ColNames]))),
    RemovedColumns = Table.RemoveColumns(ExpandedTable,{"ColNames", "Helper"}),
    ChangedType = Table.TransformColumnTypes(RemovedColumns,{{"Date", type date}}, "en-US")
in
    ChangedType

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

I got the error below. I have 39 columns I need to expand and potentially more.

 

 

Expression.Error: 39 keys were specified, but 3 values were provided.
Details:
[List]

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.