Forum Discussion
richard-powerbi
6 years agoPost Patron
Dynamically rename columns from a column names table
Let's say I have a table with 3 columns: TableName, ColumnNameOld, ColumnNameNew. I create two functions that filter TableName to the table I want, and I keep either ColumnNameOld or ColumnNameNew a...
- 6 years ago
im not sure i understand what exactly you need but perhaps List.Zip will be of help
Table.RenameColumns( Source, List.Zip( {fOldColumnNames("TableName"), fNewColumnNames("TableName") } ) )Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs
Cheers
AlB
6 years agoCommunity Champion
im not sure i understand what exactly you need but perhaps List.Zip will be of help
Table.RenameColumns(
Source,
List.Zip( {fOldColumnNames("TableName"), fNewColumnNames("TableName") } )
)
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs
Cheers
richard-powerbi
6 years agoPost Patron
Thank you! What a wonderful function! 🙂
This also has led me to this:
https://excel.city/2017/11/how-to-use-list-zip-in-power-query/
And this:
Both very useful for these kind of things.