Welcome to EMC Consulting Blogs Sign in | Join | Help

Christian Wade's Blog

MDX Sprocs: Usage

I am naturally interested in MDX stored procs so I tried them out.  I have often wondered how they compare to SQL CLR.  I hereby commit myself to (trying to) do a few blog posts in this space!  Here are some findings regarding when to use them.

It is well known that the strengths of SQL CLR for real-life scenarios are as follows.

  1. Computationally intensive operations
  2. Iteration through lists
  3. Complicated / conditional execution logic
  4. Leveraging the .NET Framework for string handling, mathematical functions, regular expressions, etc.

What about MDX sprocs?  Here is a summary of when I think they would be particularly useful.


  1. Complex calculations that require iteration.  Similarly to TSQL vs. SQL CLR, some custom calculations – e.g. financial – can be pretty much unworkable without iterating a dataset and .NET is good at this.  Not to mention the plethora of mathematical functions provided out-of-the-box by the .NET Framework.
  2. Real-time integration with data outside the cube.
    1. Dynamic sets (sets for which tuples/members are populated at runtime).  This could, for example, be used for a custom security implementation.
    2. We could also use data outside the cube to manipulate the cube data itself (not just which members are displayed).  For example, if we have a measure called Market Value and one of its inputs is current stock price(s), even the 5 minute latency (as would probably be the case with proactive caching) would be unacceptable - the numbers could be out by £ millions.  Also, if Market Value were the only measure in the cube with a real-time requirement, pro-active caching could be a sledgehammer to crack a nut.  Implementing this with an MDX sproc would be a very simple solution.

Chris Webb has blogged about MDX sprocs recently.  Here are some other good ideas:


  1. Overcoming the limitations of drillthrough by accessing the relational data in the sproc.  Sounds promising – watch this space.
  2. Leveraging the .NET Framework for string handling functions etc.  For example, this could be used to filter dimension members.

I’ve also seen examples of using MDX sprocs to administer AS through AMO, but I haven’t really seen a compelling reason to not just do it directly through AMO.


Admittedly MDX sprocs are a bit of a niche area, but I think they have huge potential.

Any other ideas for usefulness would be welcome.  I’m sure there are other clever ways of leveraging the biggest ever class library (the .NET Framework BCL).  I guess we just need to be a little creative!


Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



Christian Wade's Blog said:

A colleague of mine once asked me to do a “Number of Days since Last Incident” calculated measure (sounds...
April 30, 2006 12:00 PM

Professional Association for SQL Server (PASS) SIG said:

May 3, 2006 4:52 PM

Christian Wade's Blog said:

A colleague of mine once asked me to do a “Number of Days since Last Incident” calculated

September 2, 2006 4:25 AM

mdx dataset string cube said:

May 6, 2008 6:42 PM

Leave a Comment

Powered by Community Server (Personal Edition), by Telligent Systems