![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
| SELECT Statement (MDX) |
| Using Set Expressions |
#3
| |||
| |||
|
|
The error message helps explain the issue - MDX select query axes should have an MDX set expression. In the 1st query, the "columns" expression is numeric, whereas in the 2nd query it is a dimension member, which can be cast to a set. http://msdn2.microsoft.com/en-us/library/ms146002.aspx SELECT Statement (MDX) ... SELECT query axis clause> ::= [ NON EMPTY ] Set_Expression [ <SELECT dimension property list clause> ] ON Set_Expression A valid MDX set expression. ... http://msdn2.microsoft.com/en-us/library/ms145491.aspx Using Set Expressions A set consists of zero or more tuples. - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
| select {IIF(ISEMPTY([Measures].[Order Quantity]), |
#5
| |||
| |||
|
|
Not sure what your next level of complexity will be, but I can't reproduce the nulls at this level! So, could you cite a sample Adventure Works query? select {IIF(ISEMPTY([Measures].[Order Quantity]), 0,[Measures].[Order Quantity])} on columns, {[Date].[Calendar].[All Periods]} on rows from [Adventure Works] ------------------------------------------------- Order Quantity All Periods 274,776 - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Chapter 4 MDX Query Context and Execution 97 |
#8
| |||
| |||
|
|
Actually, the ISEMPTY() does work - but not the in way you may want. The expresssion: {IIF(ISEMPTY([Measures].[Internet Sales-Order Quantity]),0,[Measures].[Internet Sales-Internet Sales Count])} is computed once, as a query axis set expression, and the resultant set becomes the results column axis. In that context, if ISEMPTY() returns true, then there will be a query error, because 0 is not a set expression. On the other hand, the calculated member is re-computed in the context of each query results cell. If you need more details, you can consult a book like "MDX Solutions": http://www.wiley.com/WileyCDA/WileyT...471748080.html Chapter 4 MDX Query Context and Execution 97 - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#9
| |||
| |||
|
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |