How to pass a parameter in mdx?

450 views Asked by At

I have a parameter value 'SF - LYON' while trying to pass in where condition:

MEMBER [Measures].[ParameterCaption] AS [Organization].[Organization].CURRENTMEMBER.MEMBER_CAPTION 
MEMBER [Measures].[Parametervalue] AS [Organization].[Organization].CurrentMember.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS [Organization].[Organization].CurrentMember.LEVEL.ORDINAL 

SELECT non empty {[Measures].[ParameterCaption]
                , [Measures].[ParameterValue]
                , [Measures].[ParameterLevel] } ON COLUMNS 
FROM [IRIS] 
WHERE STRTomember('SF - LYON', CONSTRAINED) //@parameter=SF - LYON`

But I am getting this error:

Query (10, 1) The restrictions imposed by the CONSTRAINED flag in the STRTOMEMBER function were violated.

When I try it like this:

WHERE STRTomember('[SF - LYON]', CONSTRAINED)   //@parameter=SF - LYON

it is working.

So my question is: How do I pass the square brackets [] through a parameter to get the desired result?

1

There are 1 answers

2
whytheq On

You can build up the parameter string with square brackets before passing it to the strToMember function