Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

How to use union to apply OR logic in MDX.

$
0
0

This query can set OR logic and to get the results.

SELECT { 
	      [Measures].[Reseller Order Quantity],
		  [Measures].[Reseller Order Count] 
	   } ON 0,
NON EMPTY {[Product].[Subcategory].MEMBERS} ON 1
FROM [Adventure Works]
WHERE
(
	{
		([Product].[Color].&[Black],[Product].[Size Range].[All Products]),
		([Product].[Color].[All Products], [Product].[Size Range].&[XL]) 
	}
)

How to use UNION to get this result, I tried some queries but it seems the result is always different.

SELECT { 
	      [Measures].[Reseller Order Quantity],
		  [Measures].[Reseller Order Count] 
	   } ON 0,
UNION(
		NONEMPTY(
					[Product].[Subcategory].MEMBERS,
					(
						[Product].[Color].&[Black],
						[Product].[Size Range].[All Products]
					)
				),
		NONEMPTY(
					[Product].[Subcategory].MEMBERS,
					(
						[Product].[Color].[All Products],
						[Product].[Size Range].&[XL]
					) 
				) 
	)
ON 1
FROM [Adventure Works]


Please vote if it's helpful and mark it as an answer!



Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>