Forum Discussion
Power Query custom function to loop over multiple tables and do the required transformation
- 2 years ago
Yeah, no. You cannot inject transforms into queries from the outside. You need to do these transforms in each of the queries, or follow my approach and then use references.
lbendlin, thank you for the response!
Yes, I know that we can iterate over rows of table and each row could refer to a table, but my scenario is little different.
I have a key column in all the tables which I want to convert to a primary key column using Add.Key() funtcion.
So I have
Table1
Table2
Table3
in Power Query.
I want to create a custom function, that could iterate over each individual table and perform the Table.AddKey(table, "Key", true). In other word this would be added a last tranformation step in each tables' APPLIED STEPS pane.
You can suggest any other better approach. Please note that I have separate tables and after the above transformation I still want them seprate.
Thank you!
- lbendlin2 years agoSuper User
Yeah, no. You cannot inject transforms into queries from the outside. You need to do these transforms in each of the queries, or follow my approach and then use references.