Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Apply same transformations to multiple tables/excel sheets

Good afternoon

I'm looking for a way for the transformations I apply to modify a set of tables or Excel sheets.

Guicar_0-1670099920232.png

Something similar to when we connect to a folder, select "combine and transform" and obtain the function automatically with the example file.

1 ACCEPTED SOLUTION

That's what I meant when I wrote: "Apply the transforms against one of the sheets or files, then extract the code into a function, then apply that function to all sheets or files".

 

A parameter can be fed from a list query.  But that's rather pointless as you can instead use that query directly in your ETL.

 

lbendlin_0-1670781028516.png

 

View solution in original post

4 REPLIES 4
tackytechtom
Super User
Super User

Hi guys,


I know, I am very late to this party, but I really like lbendlin's approach here: Outsourcing your M code transformations into functions and then reusing those to run against your target tables.


I happened to have written an article about this topic, where you first define your functions and then populate a configuration table specifying where you wanna apply those functions to. Finally a Data Quality Check / Cleaning function leverages the previous information to do the cleansing. It's a decently scalable approach since the logic is decoupled and can be reused easily as many times as you want. The blog article can be found here.

 

Hope this can help someone passing by this thread in the future 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Syndicate_Admin
Administrator
Administrator

Thank you for the reply.

I manage to do it through a parameter that focuses on a list generated with unique values of a column of a table, changing the default value that forces you to enter the parameter. But how to make the parameter have that list as a default value and not a single value of it? Or do you have put it another way to generate all the tables with the same transformation at once?

The data source function = folder applying merge and transform data, generates a sample file (which in our case would be a value of the list (list extracted from the column values of a table).
How is it solved with M code?
Thank you very much in advance to any help.

That's what I meant when I wrote: "Apply the transforms against one of the sheets or files, then extract the code into a function, then apply that function to all sheets or files".

 

A parameter can be fed from a list query.  But that's rather pointless as you can instead use that query directly in your ETL.

 

lbendlin_0-1670781028516.png

 

lbendlin
Super User
Super User

Apply the transforms against one of the sheets or files, then extract the code into a function, then apply that function to all sheets or files.  Similar to what you would do in Excel where you record a macro for your steps and then examine the resulting macro to include in your code.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.