MDX complement operator problem

Playing with Microsoft SQL Server Analysis services 2005 and MDX language. Could not find many resources or error reference on the internet.

The following MDX query was created using query painter:
Select (-({[My Dimension].[My Hierarchy].[My Level].&[Not existing member]})) ON COLUMNS FROM [My Cube]
Executing this query results in an error:
[code]Set used with the complement operator must have all members from the same level.[/code]
Workaround is to use EXCEPT function instead of "-" operator like this:
Select ({EXCEPT([My Dimension].[My Hierarchy].[My Level],[My Dimension].[My Hierarchy].[My Level].&[Not existing member])}) ON COLUMNS FROM [My Cube]

Leave a Reply