• Personally I think the easiest option is to use Power Query.

    You can check the blog of Chris Webb on how to make functions inside Power Query.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP