Erik Svensen shows that you can call user-defined scalar functions in SQL Server from Power Query:
Currently I am working with a project where we extract data from a SQL server – some of the business logic is built into scalar value functions (documentation).
Now the magic of PowerQuery enables us to reuse these functions within PowerQuery and Query Folding is supported – more about this at the end of this post.
My initial reaction is “That way lies madness” but in moderate doses, I could see this as a valuable second-best option for teams pulling data into Power BI.