Forum Discussion
rpiboy_1
3 years agoHelper V
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.ID | name | pq.datatype |
| 2020 | Name1 | Text.Type |
| 1011 | Name2 | Int64.Type |
| 1212 | Name3 | Decimal.Type |
=Table.TransformColumnTypes(YourTable,Table.ToList(YourTypeTable,each {_{1},Expression.Evaluate(_{2},#shared)}))
2 Replies
- wdx223_DanielCommunity Champion
=Table.TransformColumnTypes(YourTable,Table.ToList(YourTypeTable,each {_{1},Expression.Evaluate(_{2},#shared)}))
- rpiboy_1Helper V
wdx223_Daniel thanks so much, worked perfectly!