Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi,
i have a question aubout power query. Is there any posibillity to generate automatically the column caption from an table which is retrieved via api from a database?
So far i have to hardcode it into my last step:
The problem is, that i want to switch beetwenn other tables and therefore i have to change this step of code by my self.
this is my code jet:
Have anyone an idea?
Thanks in advance
Solved! Go to Solution.
Since it's a record column, I think you'd use Record.FieldNames instead.
Maybe like this:
[...]
#"Custom items" = Table.ExpandListColumn(#"Removed Columns", "data"),
ColumnList = Record.FieldNames(#"Custom items"{0}[data]),
#"Expanded data" = Table.ExpandRecordColumn(#"Custom items", "data",
ColumnList, List.Transform(ColumnList, each "data." & _))
in
#"Expanded data"
Not totally clear on your scenario, but you can use Table.ColumnNames() on your [data] column to dynamically generated a list of the column names and use that in place of the hard-coded list.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Since it's a record column, I think you'd use Record.FieldNames instead.
Maybe like this:
[...]
#"Custom items" = Table.ExpandListColumn(#"Removed Columns", "data"),
ColumnList = Record.FieldNames(#"Custom items"{0}[data]),
#"Expanded data" = Table.ExpandRecordColumn(#"Custom items", "data",
ColumnList, List.Transform(ColumnList, each "data." & _))
in
#"Expanded data"
hi @AlexisOlson,
Is there also a possibility, if in the output table there are still several columns with records to output them also variably? Or du i have to output them step by step?
You could probably do it but it would likely be more trouble than it's worth unless you have a whole bunch of columns to expand.
The problem is that I would like to apply the code variably to several tables. These do not always have the same headings and therefore cannot be hard-coded.
Yes that was exactly what i was looking for 😉
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |