March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Problem:
I often find that I want or need to reuse a Power Query function or approach in one Excel workbook that I've used in a previous Excel Workbook, without the hassle of "reinventing the wheel". I know there is a solution to this dilemma with regards to Excel Macros (link below) but I haven't found or figured out a way to accomplish this with Power Query.
Question(s):
PERSONAL.xlsb for reusing Excel Macros across any workbook:
Solved! Go to Solution.
This does not exist unfortunately.
I built a VBA macro to copy queries from and to personal.xlsb. It is a bit of a hassle to setup, but it works for me.
I have also thought about using a seperate workbook to store all librray queries in a worksheet and load them in a powerquery record using Powerquery itself. Expression.Evaluate should be able to do the trick.
Assumming you name the record M, you could call each function or query as M[Your Query Name Here].
I did a proof of concept, but never finished it. Advantage over the VBA is that you always work with the lastest version. Downside is that it is a bit of a hassle to maintain....
Thanks for the link to the other post. Still wish this was something that was native to the Power Query platform, but this is a great alternative.
OMG., @dufoq3 , thank you for sharing. And to this day, yes, @jennratten is still Awesome 🙂
If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you. Proud to be a Super User!
Thanks! Also a good one! Easy to update.
I would extend it with puting all queries in a separate directory and automatically store all functions as separate fields in a record.
I only need to copy paste 1 query in all sheets with powerquery to boot strap the function loading process.
Anyone interested in the full solution? Then I will build it.
Turn those reusable steps to user-defined functions.
(arg1, arg2, ...) =>
let
step1 = "...",
setp2 = "..."
...
setpn =
in
stepn
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Yes - completely agreed and I do when it makes sense. However when a user-defined function (UDF) is created, it only exists (natively) within the workbook it's created in. Let's say I need to perform the same steps from the UDF but in a different Excel workbook. I either have to:
The idea behind saving Excel macros to PERSONAL.xlsb is that it creates a single point for all macros you want available in other workbooks. My question is specific to this concept, but applied to Power Query.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
16 | |
13 | |
12 | |
9 |
User | Count |
---|---|
34 | |
31 | |
20 | |
19 | |
17 |