Forum Discussion

rpiboy_1's avatar
rpiboy_1
Helper V
3 years ago
Solved

Dynamically Change Column Type by List

I'm able to dynamically rename a series of columns using List.Zip to zip together two columns from another table. The same table also contains the data type that should be applied in Power Query to the column (text, number, etc).

 

Is there a way I can do something similiar with Table.TransformColumnTypes? Nothing was jumping out to me as to how I could make the syntax work.

 

This is what the table looks like with the column data:

column.IDnamepq.datatype
2020Name1Text.Type
1011Name2Int64.Type
1212Name3Decimal.Type
  • =Table.TransformColumnTypes(YourTable,Table.ToList(YourTypeTable,each {_{1},Expression.Evaluate(_{2},#shared)}))

2 Replies