![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a way to see the underlying MDX when querying through the cube browser, either through Management Studio or Analysis Project? I tried with SQL Profiler, and am seeing something that is not too useful: SELECT NON EMPTY [{E551D847-D2CF-4C00-81AE-A8BA98DF2363}Pivot54Axis1Set0] DIMENSION PROPERTIES MEMBER_NAME, PARENT_UNIQUE_NAME ON COLUMNS, { [Measures]... } ON ROWS FROM [Adventure Works] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORE_COLOR, BACK_COLOR |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Hi Chris, I have bought 2 books on MDX: 'Fast Track to MDX - 2nd Edition' and 'MDX Solution - 1st edition' As we need the knowledge last year, we could not wait for the 2nd edition to be released. Do you know which distribution/publish give better offers for the 2nd edition, e.g. free copy of ebook is included for those order directly from them, etc..? Most of my team members are from OLTP/ETL background and are very comfortable with TSQL. We are struggling/suffering from MDX, as it looks like TSQL but is actually very different. We are struggling with even very simple things sometimes, e.g. 1. finding out if there's a ISNULL() equivalent in MDX that can help us handle the invalid dimension dimension elegantly (I posted my question here http://groups.google.com/group/micro...620eeb057390a), and also 2. the equivalent for <>, e.g. in TSQL it will be WHERE UserID <> 100. We found a solution using EXCEPT(set1, set2) but are not sure if that's the right way..... you can imagine the frustrations..... |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
1) The report parameter is coming from AS indeed, and Reporting Services does auto-generate a MDX that retrieves a list of the valid values as you described. All is well, except that the consumer web-application can invoke a report with a URL access without first validating if that's an valid Dimension member. Yes, you are absolutely right, the error is from Reporting Services, because the parameter value received is not in the available value list! Now, if I can have another parameter that is accepting the value and is not bound to the available value list, and when processing a call with an invalid value, the error displayed is now "Query (1, 598) The restrictions imposed by the CONSTRAINED flag in the STRTOSET function were violated. " Now, that's an AS error, because [Product].[Category].&[5] (a non-existing Dimension Member) has been used to make such a query: WITH MEMBER [Measures].[Profit] AS '[Measures].[Sales Amount]-[Measures].[Standard Product Cost]' SELECT NON EMPTY { [Measures].[Internet Sales Amount], [Measures].[Internet Total Product Cost], [Measures].[Internet Order Quantity] } ON COLUMNS, NON EMPTY { ([Sales Reason].[Sales Reason].[Sales Reason].ALLMEMBERS * [Sales Territory].[Sales Territory Group].[Sales Territory Group].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, [Sales Reason].[Sales Reason].[Sales Reason].KEY, [Sales Territory].[Sales Territory Group].[Sales Territory Group].KEY ON ROWS FROM ( SELECT ( STRTOSET('[Product].[Category].&[5]', CONSTRAINED) ) ON COLUMNS FROM [Adventure Works]) WHERE ( IIF( STRTOSET('[Product].[Category].&[5]', CONSTRAINED).Count = 1, STRTOSET('[Product].[Category].&[5]', CONSTRAINED), [Product].[Category].currentmember ) ) In your posting, 'IIF(VBA!ISERROR(STRTOVALUE("MEASURES.[THIS WONT WORK]")), 1,0)' is able to catch an invalid MEASURE. I suspect maybe the following can help me to detect invalid dimension members? WITH MEMBER MEASURES.TEST AS 'IIF(VBA!ISERROR(STRTOSET("[Product].[Category].&[1]", CONSTRAINED).COUNT),1,0)' MEMBER MEASURES.TEST2 AS 'IIF(VBA!ISERROR(STRTOSET("[Product].[Category].&[5]", CONSTRAINED).COUNT),1,0)' SELECT {MEASURES.TEST, MEASURES.TEST2} ON 0 FROM [Adventure Works] Then, if I have prepared a 'DEFAULT' Dimension Member ([Product].[Category].&[-999] in the example below) to handle all the invalid calls, then I may be able to tweak the MDX to the following? WITH MEMBER [Measures].[Profit] AS '[Measures].[Sales Amount]-[Measures].[Standard Product Cost]' SELECT NON EMPTY { [Measures].[Internet Sales Amount], [Measures].[Internet Total Product Cost], [Measures].[Internet Order Quantity] } ON COLUMNS, NON EMPTY { ([Sales Reason].[Sales Reason].[Sales Reason].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, [Sales Reason].[Sales Reason].[Sales Reason].KEY, [Sales Territory].[Sales Territory Group].[Sales Territory Group].KEY ON ROWS FROM ( SELECT ( IIF( STRTOSET(@ProductCategory).Count = 1, STRTOSET(@ProductCategory, CONSTRAINED), [Product].[Category].&[-999] ) ) ON COLUMNS FROM [Adventure Works]) WHERE ( IIF( STRTOSET(@ProductCategory).Count = 1, STRTOSET(@ProductCategory, CONSTRAINED), [Product].[Category].currentmember ) ) 2. Chris, what's the function of the CONSTRAINED flag? I found that if I include this CONSTRAINED flag into IIF( STRTOSET(@ProductCategory, CONSTRAINED).Count = 1, the query above stops working. |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Got your point! OK, lets get the consuming application to first query AS to verify if the member exists, would something like this be the correct kind of query to be used? WITH MEMBER [Measures].[X] AS STRTOSET('[Product].[Category].&[1000]', CONSTRAINED).Count SELECT [Measures].[X] ON 0 FROM [Adventure Works] My testing shows the count=1 is returned if the member is valid, otherwise #ERROR is returned. |
#9
| |||
| |||
|
#10
| |||
| |||
|
As there is no way to see the underlying MDX generated.... , whatshall I do to get AS to return the data that is same when the "Show Empty Cells" is enabled in a cube browser? For example, "Show Empty Cells" is enabled when filtering by Country: Country City Sales UK London $100,000.00 UK Liverpool (blank) ..... When it is disabled, only UK->London is return because the data is not blank. I tried with including/excluding "NON EMPTY" in the MDX, there is no difference ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |