Friday, 2 August 2013

EXCEPT in MDX

EXCEPT function can be use for explicitly excluding a dimension level from resultset even though that dimension is not part of query.

Example:

Query 1:  Gets "Reseller Order Count" for all countries.

SELECT
     [Measures].[Reseller Order Count] ON COLUMNS
FROM [Adventure Works]



Query 2: Gets "Reseller Order Count" for all countries except "United States"

SELECT
     [Measures].[Reseller Order Count] ON COLUMNS
FROM [Adventure Works]
WHERE EXCEPT
(
    [Geography].[Geography].[Country]
    ,[Geography].[Geography].[Country].&[United States]
)

No comments:

Post a Comment