VBA functions in MDX and DAX

It turns out that the Visual Basic for Applications library functions are a great way to extend the functionality of your MDX statements, allowing you to do some very handy stuff.

Analysis Services uses stored procedure technology to extend the number of built-in MDX functions. It automatically registers two libraries: the Visual Basic for Applications library and the Microsoft Excel worksheet library. Visual Basic for Applications library is registered as a CLR assembly and Excel library – as COM assembly. MDX expressions can use any of supported VBA and Excel functions, as if there were native MDX functions.

However, it comes with a cost of performance,  CLR assemblies are hosted in a separate application domain and in addition to marshaling from native to managed code and back, all the calls are also marshaled across application domains, therefore calling a VBA function is an expensive operation comparing to calling an MDX function.

Here is a list of all the VBA functions available in Microsoft Visual Basic for Applications Language Reference that are supported in MDX; also, the list includes a note when there is functional equivalence with the DAX language.