Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Everyone,
I have multiple tables (Around 10) in Power Query and I want to do some transformation to all the Tables. Say I want to add a custom column to all the tables.
I want a custom function which when invoked could loop over each table one by one and add the custom column to each table.
Is that even possible in Power Query?
Thanks in advance for any help in this regard.
Rashid
Solved! Go to Solution.
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.
Got it @lbendlin . If I follow your approach, then I will have a list of tranformed tables or a table containing 3 rows, each row referencing to a tranformed table. Can I extract each table as seprate table?
Not in Power BI. Maybe in Excel. Maybe via the Graph API
@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!
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.
yes, that is possible, and it is standard procedure in Power Query, Actions usually iterate over the rows of a table (which can reference your tables).
What do you want to do after you modified the tables?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |