Search code examples
mdxmsas

Escaping special characters in an MDX Query


I'm building a BI dashboard for my client. Our data is stored in an analysis server cube. Overall things work great, but a smartalec tester decided to create a merchant with the name `~!@#$%^&*()_+-=[]{}|;':"<>?,./ The name shows up just fine as a part of a query result, but if the user trys to drill in to the merchant we of course blow up b/c the \ { ; [ " are all part of MDX. Is there a way to escape these characters? I've tried putting a \ in front, or doubling the character. I've searched all over, but not turn up anything.

TIA


Solution

  • You must use the [] notation for your names and escape (only) the right bracket. Here is an example declaring a calculated measure with the name to escape (notice the ]] ):

    with member [`~!@#$%^&*()_+-=[]]{}|;':"<>?,./] as 42
    select [`~!@#$%^&*()_+-=[]]{}|;':"<>?,./] on 0 from [cube]