- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

how to get column names dynamically when expanding tables?
Hi everyone,
I have a table like this, and i want to expand the column "Datei transformieren"
When I click to expand the code it looks like this:
Now I want to use codes to get the column names dynamically to prevent column name changes or errors when new column names appear, how can i do that?
I've tried the code like this:
Expand = Table.ExpandTableColumn(#"Andere entfernte Spalten1", "Datei transformieren", Table.ColumnNames(#"Andere entfernte Spalten1"{0}[Datei transformieren]))
But then I can only get some of the column names and not all of them, because each table has different column names.
Maybe there are some codes to replace that big list of column names above?
Thanks a lot!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Problem Solved. Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

While it is technically possible, it is quite a resource expensive approach to read all the headers from all the tables to then create a custom list of headers that you might want to expand.
You can try and leverage an approach that uses the following functions:
- Table.Column
- You can use this function to extract the column where you have the table values from your table and then have a list of tables that you can use with List functions
- List.Transform
- This is a common List function to help you transform the values inside of a list based on your specific logic
- Table.ColumnNames
- This is a function that effectively extracts the column names from your table and the output is a list of strings (the strings being the column names)
- List.Combine
- Similarly to how the "Append" operation works to combine multiple tables (it uses Table.Combine behind the scenes), List.Combine "Appends" lists into a single list
- List.Distinct
- Once you have the values of all list of columns into a single list, you will end up with a lot of duplicate names for the column names. This function will help you get rid of the duplicates
There are other approaches, but they depend on what your requirements. I'm sharing the links below as other approaches that I've used throughout the years:
https://www.youtube.com/watch?v=XPWnPAhQEiQ
https://www.youtube.com/watch?v=omu-sjzNO44
Hope this puts you in the right path!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for your answer

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
04-05-2023 12:18 AM | |||
02-16-2024 06:45 AM | |||
Anonymous
| 06-04-2024 03:33 AM | ||
02-20-2024 07:12 AM | |||
05-28-2024 04:06 AM |
User | Count |
---|---|
27 | |
25 | |
25 | |
13 | |
9 |
User | Count |
---|---|
24 | |
19 | |
16 | |
13 | |
10 |