Solved

Problematic MDX query and getting descendents

Posted on 2008-06-10
7
861 Views
Last Modified: 2013-11-16
I am trying to figure out an issue with my MDX query.  I am fairly certain it is an issue with the data in the data warehouse because it works on some DWs, but not all, and they all have the same structure.  I am fairly new to MDX, and I am at a loss as to how to troubleshoot this further.   The error is that the cells cannot be created for this cellset because one of the axes contains no positions.  I am using Analysis Services 2000.

Here is the query:

WITH MEMBER [Measures].[Ranking] As ' Rank ( [OBR], { [Top10] } ) ' SET [Top10] As ' { TopCount ( {Filter ( {Descendants ( [OBR].[Compensation],2 ) }, ( ([Measures].[RRPayoutBasisAmount],[Dates Broker].[All Dates Broker].[2008]) <> 0 ) )},10, ( [Measures].[RRPayoutBasisAmount], [Dates Broker].[All Dates Broker].[2008] ) ) } ' SELECT { CrossJoin ( { [Dates Broker].[All Dates Broker].[2008] }, {[Measures].[Ranking], [Measures].[RRPayoutBasisAmount]}) } ON COLUMNS, { [Top10] } ON ROWS FROM [Payout]

If I change the way that it gets the Descendents to {Descendants ( [OBR].[Compensation],1, AFTER ) } it works correctly.  Also, if I change the filter criteria to =0 rather than <> 0 returns data, but not ordered correctly.


0
Comment
Question by:kerryhill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 8

Expert Comment

by:srnar
ID: 21758319
What do you mean "not ordered correctly". For sorting there is as you know a sort function with BDESC (break descendants) flag.
0
 

Author Comment

by:kerryhill
ID: 21759866
With the TopCount, it usuallys orders the records by ( [Measures].[RRPayoutBasisAmount], [Dates Broker].[All Dates Broker].[2008] ), but when I change the filter to = 0 rather than <> 0 it returns records, but they are not ordered by ( [Measures].[RRPayoutBasisAmount], [Dates Broker].[All Dates Broker].[2008] ).  They seem to have their default order.  The records that are returned when I change the filter to  ([Measures].[RRPayoutBasisAmount],[Dates Broker].[All Dates Broker].[2008]) = 0 ) are not all 0 values either, it is very odd.  

I have about 30 databases that use this MDX query, and it does not work on around 10 of them, but it is fine on the others.  I have one database where there is a test copy of the data, which is an older copy of the same database where this does not work, and it works correctly.  If I take the OLAP database and point it to that test copy of the database and process it, it works correctly.  

At some point the data seems to have gotten out of whack, but I am confused as to how to figure out how.  It seems strange that it works correctly if I get the list of Descendents by doing a 1, AFTER, but if I go directly to the 2nd Level, it does not work (Descendents,2)?

Thank you for any help you can offer.
0
 
LVL 8

Expert Comment

by:srnar
ID: 21768501
kerryhill, that seems weird (20 from 30 works fine) - it may come from data. Do you have MemberNamesUnique set to True on queried dimensions?

If not - is it possible to set it (on 2005 version it does not need reprocess but not sure on 2000) and retry MDX?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kerryhill
ID: 21772888
I can't because the member names are not unique.  I checked the test copy of the database, and it is set to false as well, but the MDX is successful on that db.  I agree that it is data related.  I just can't find the bad data....

I guess I am confused as to what is the difference between going directly to Level 2 of the dimension, and using "1, AFTER "?  
0
 
LVL 8

Accepted Solution

by:
srnar earned 500 total points
ID: 21792035
kerryhill, there is a difference between the two: "1, AFTER ", Level 2. Default flag in Descendant function is SELF - so it takes only members of the 2nd level (no 3 level, no LEAVES...). Equivalent to "1, AFTER " is "2, SELF_AND_AFTER". See following snippet from Adventure Works.
--176 rows (incl header) - members including leaves with Amount not empty
select [Measures].[Sales Amount] on columns,
nonempty(
	descendants(
		[Product].[Product Categories].[All Products], 1, AFTER
	)
) on rows
from [Adventure Works];
 
--ame as above
select [Measures].[Sales Amount] on columns,
nonempty(
	descendants(
		[Product].[Product Categories].[All Products], 2, SELF_AND_AFTER
	)
) on rows
from [Adventure Works];
 
--38 rows (incl header) - 37 members of the Subcategory level
select [Measures].[Sales Amount] on columns,
(
	descendants(
		[Product].[Product Categories].[All Products], 2
	)
) on rows
from [Adventure Works];
 
--same as above - SELF is default
select [Measures].[Sales Amount] on columns,
(
	descendants(
		[Product].[Product Categories].[All Products], 2, SELF
	)
) on rows
from [Adventure Works];
 
--180 rows (incl header) = like 1 AFTER + {[All Products], [Accessories], [Bikes], [Clothing]}
--note Compoents member has [Sales Amount] empty
select [Measures].[Sales Amount] on columns,
nonempty(
	descendants(
		[Product].[Product Categories].[All Products], 2, SELF_BEFORE_AFTER
	)
) on rows
from [Adventure Works];

Open in new window

0
 

Author Closing Comment

by:kerryhill
ID: 31465991
It did confirm that I was not crazy.  I used the work around, I am still not sure why it doesn't work going directly to the child branch.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question