Different Between Where Clause and SubSelect Expression

Tried search up and down from google about the different between where clause and SubSelect expression in the MDX statement but i make me more blur about it. I do some R&D on the [All] member and i found one different that i would like to share out.

With “Where Clause” Statement

SELECT
{
[Measures].[Sales Amount]
} ON COLUMNS,
{
[Product].[Product Categories].[All]
} ON ROWS
FROM [Adventure Works]
WHERE ({[Product].[Product Model Lines].[Model].MEMBERS -
[Product].[Product Model Lines].[Model].&[Bike Wash] -
[Product].[Product Model Lines].[Model].&[Cable Lock] -
[Product].[Product Model Lines].[Model].&[Classic Vest]});

Return Result:

With “SubSelect” Statement

SELECT {
[Measures].[Sales Amount]
} ON COLUMNS,
{
[Product].[Product Categories].[All]
} ON ROWS
FROM (
SELECT {[Product].[Product Model Lines].[Model].MEMBERS -
[Product].[Product Model Lines].[Model].&[Bike Wash] -
[Product].[Product Model Lines].[Model].&[Cable Lock] -
[Product].[Product Model Lines].[Model].&[Classic Vest]} ON COLUMNS
FROM [Adventure Works]
);

Return Result:

Comparison about both statement
You can see both statement return different result and the different is $294,120.56. When system pulling the [Product].[Product Categories].[All] for the “where clause”, it didn’t adjusted the [All] member value to the filtered context. But the “Subselect statement” was adjusted based on the filtered context.

Filtered members value

SELECT
{
[Measures].[Sales Amount]
} ON COLUMNS,
{
[Product].[Product Model Lines].[Model].&[Bike Wash],
[Product].[Product Model Lines].[Model].&[Cable Lock],
[Product].[Product Model Lines].[Model].&[Classic Vest]
} ON ROWS
FROM [Adventure Works];

Return Result: Total = $294,120.56.

Conclusion
Now you will get more clear picture about the [All] member for “where clause” still refer to the unfiltered members but “subselect statement” will refer to subcube that already filtered out the members.

Will put in more differences in future.

To run the sample code, you must install the AdventureWorks sample.