I wrote a simple C# class that is useful to manage custom MDX scripts (like custom members definitions) on existing cubes, without the need of a new deployment.

I named it MdxScriptUpdater and it is freely available here: http://www.sqlbi.eu/mdxscriptupdater.aspx

This is an excerpt from the whole article that describes the library (and some trick about AMO library):

MdxScriptUpdater is a simple C# class that simplifies updating MDX Scripts into a cube in a production environment. MdxScriptUpdater is provided in form of a sample source code as is.

There are a lot of scenarios where nightly batches would update parts of the MDX Script of a cube. For example, I had a customer with a calculated member for each year with data. We can define the calculated member by hand, but we would need to remember to create a new one each year. Another case is the customer that wants to consolidate his own calculated members, without requiring a new cube deployment.

 

AMO (Analysis Services Management Objects) is the API that allows you to do these kinds of modifications on a running cube. The problem arises when you want to preserve existing MDX scripts, adding and removing only your own. We tried to solve this problem in a generic way.

I would like to get feedback and also possible bugs…