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
fsim
Responsive Resident
Responsive Resident

table.ExpanTableColumn with changing columns' names

hi there,

Every month I get a brunch of 20 xls files containing 12+ columns. The name of those columns changed every month (typically previous 5 months, current month, next 6 months ) . How can I use the Table.ExpandTableColumn function without knowing the names of the columns ?

I tried Table.ExpanTableColumn(#"PreviousStep", "XlsContent",{*}) and, of course, it didn't work 🙂

I guess I should get them from a function, but I can't figure out wich one.

Can you help ?

 

thanks !

 

 

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @fsim 

 

Please, see the attached file with a solution, it will look at all the column names within the tables and use this as a list to expand columns

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

View solution in original post

5 REPLIES 5
Jimmy801
Community Champion
Community Champion

Hello @fsim 

 

use this codesnippet to understand how to build your Table.ExpandColumn dynamically.

    ExpandAllColumns = Table.ExpandTableColumn
    (
        PreviousStep, 
        "ColumnToBeExpanded", 
        List.Union
        (
            List.Transform
            (
                List.Buffer(PreviousStep[ColumnToBeExpanded]), each Table.ColumnNames
                (
                    _
                )
            )
        )
    )
in
    ExpandAllColumns

 

If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun

Jimmy

fsim
Responsive Resident
Responsive Resident

@Jimmy801  Hello ! Thank you for your answer. I will also check your solution ! 

kr,

 

Fred

Jimmy801
Community Champion
Community Champion

Hello @fsim 

 

that would be nice 🙂

Thank you

 

have a nice day

 

Jimmy

Mariusz
Community Champion
Community Champion

Hi @fsim 

 

Please, see the attached file with a solution, it will look at all the column names within the tables and use this as a list to expand columns

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

fsim
Responsive Resident
Responsive Resident

Hi @Mariusz  this is perfect, 

Thank you so much.

 

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 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.

Top Solution Authors