views:

49

answers:

3

This MDX request works:

SELECT [Measures].salescount ON COLUMNS,
[Date].[2010] ON ROWS
FROM [SalesAnalysis]
WHERE [Area].[Shanghai]

This one works too (different WHERE condition):

SELECT [Measures].salescount ON COLUMNS,
[Date].[2010] ON ROWS
FROM [SalesAnalysis]
WHERE EXCEPT([Product].[All Products].Children, {[Product].[All Products].[#null]})

Question: How do I write a request with both conditions?
i.e. area condition AND product condition

I tried , and AND but no luck so far.

A: 

SELECT [Measures].salescount ON COLUMNS, [Date].[2010] ON ROWS FROM [SalesAnalysis] WHERE {[Product].[All Products].Children, [Product].[All Products].[#null] }

akshay
?? The Shanghai condition does not appear in your request.
Nicolas Raoul
I tried something inspired from your syntax, but it does not work. I can't place my two conditions in the same accolade with a comma, I get: Mondrian Error:All arguments to function '{}' must have same hierarchy.
Nicolas Raoul
+1  A: 

I guess you need to define a set within your slicer:

SELECT [Measures].salescount ON COLUMNS, [Date].[2010] ON ROWS FROM [SalesAnalysis] WHERE [Area].[Shanghai] * EXCEPT([Product].[All Products].Children, {[Product].[All Products].[#null]})

Pay attention that MDX slicer is not a SQL WHERE statement; you might have a look to MDX sub-select instead.

Marc Polizzi
Thanks it works! Detail: missing closing parenthesis at the end of the query, you might want to add it.
Nicolas Raoul