Once you’ve discovered the huge potential R gives you to expand your analytical toolbox in Power BI (check some tips & tricks in my previous blogpost if you haven’t already), you might wish to have all your awesome functions conveniently at hand when designing new solutions. And thanks to M, there’s actually nothing easier than that: R-function-library in a record (which works just the same for M-functions 🙂 )
Put your functions into a record (fnr) with the function name as the field name and the function itself as the value: One query to hold them all (and not cluttering your editor pane) and ready to use as if they were native functions:
will export content of my query “Actuals” to csv-file on my desktop.
- fnr is the name of the record. You can give it your own name of course, I prefer to keep this as short as possible.
- followed in square bracket is the name of the function (record field name)
- in ordinary brackets you have the function arguments just like in standard M (record value)