MDX WHERE: "AND" between several conditions

This MDX request works :

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

This one works too (another 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 to write a query using both conditions ?
<i> that is. area status and product status

I tried ,and AND, but so far no luck.

+3
source share
6 answers

I think you need to define a set in 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]})

Note that the MDX slicer is not an SQL WHERE statement; you can instead select the MDX sub-selection.

+3
source

: (-)

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

USE * AND ,.

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

, -

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

, * AND.

:

select {[Measures].Members} ON COLUMNS, 
       {[Product].Members} ON ROWS
       from [data_cube]
       where {[Location].[New York] * [Time].[2015]}

:

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

Source: https://habr.com/ru/post/1771642/


All Articles