Search code examples
ssasmdx

String to MDX code


I have the following scenario:

I have my MDX code in a cell in a dimension.

e.g. [MDXCode].[Code].[Code] contains the string:

"([GL Account].[GL Account Code L1].&[ABC],[Measures].[Amount]) + ([GL Account].[GL Account Code L1].&[XYZ],[Measures].[Amount])"

Now I want this cell evaluated as MDX code.

I tried with StrToMember and ToTuple but do not get it working. e.g.

StrToTuple([MDXCode].[Code].[Code])

However if I limit my example to ([GL Account].[GL Account Code L1].&[ABC],[Measures].[Amount]) it works. If I add another tuple to sum both it does not..


Solution

  • Try this:

    StrToValue([MDXCode].[Code].CurrentMember.Name)
    

    Edit upon further info. If you can make MDX Formula a property of Ratio Name:

    StrToValue([Finance Ratio].[Ratio Name].CurrentMember.Properties("MDX Formula"))