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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MrDeg
Frequent Visitor

Where to store my personal library of custom functions

Hi, 

 

Is there a way to easily store and mantain the custom functions that I'm building?

I'm thinking on a library of "personal" M functions that I can update as needed (add new function, modify existing function) and pass from one project to another.

 

thank you in advance,

 

P.s.: Some background: I'm from VBA, I used to keep all my custom functions in some modules (each module was a theme from my library e.g.: "Strings Manipulation", "Arrays","Maths"). every time I created a new project I transferred the modules to the new workbook (with my "Transfer Library" function that transfers the modules) and I was good to go.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MrDeg ,

 

I think you can create report templates.

Power BI report templates contain the following information from the report from which they were generated:

  • Report pages, visuals, and other visual elements
  • The data model definition, including the schema, relationships, measures, and other model definition artifacts
  • All query definitions, such as queries, Query Parameters, and other query elements

 

Reference: Create and use report templates in Power BI Desktop

 

Hope to help you.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
ChrisCB
Regular Visitor

@Anonymous

No offense but that's an extremely poor solution. No version control, no diff, no lint, and its even a hassle for reusability. One should be able to start a blank project, import some version controlled text files and move on with their lives.

 

This being for M and DAX code specifically, but lets be honest, everything inside PBI is likely in some xml schema or another, there's no reason to limit code/visualization reuse to literal PBI template files. What is this, a circa 1998 excel macro library?

Anonymous
Not applicable

Hi @MrDeg ,

 

I think you can create report templates.

Power BI report templates contain the following information from the report from which they were generated:

  • Report pages, visuals, and other visual elements
  • The data model definition, including the schema, relationships, measures, and other model definition artifacts
  • All query definitions, such as queries, Query Parameters, and other query elements

 

Reference: Create and use report templates in Power BI Desktop

 

Hope to help you.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For most of my code requirements, be it DAX, SQL or power query scripts, I use the following method which is easy to use and easy to get at: 

 

  • Create two folders, one called power query functions, the other called power query scripts. 
  • In each folder, create text files for each function or script you want to save. 
  • You need to have good naming conventions, eg any functions that are date related, have the file something like "Dates - my date function".
  • In the scripts folder, similar to functions, save useful power query scripts that you wouldn't usually remember. For example a text file containing details of how to refer to a column in a user defined function.
  • All of the saved files should be plain text files, so you can easily grab the code.

Do the same for DAX scripts, create a folder called DAX, and save any measure or column formulas you need to refer to.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors