Solved

Using the EXCLUDEEMPTY  in mdx count returns Error

Posted on 2012-03-23
2
955 Views
Last Modified: 2012-04-12
Hi All

I am new to MDX so please excuse the ignorance :)   I have create the following MDX statment:

with 
member [measures].[count of existing records] as Count({[Location].[Code].MEMBERS}, EXCLUDEEMPTY)
member [measures].[Stk Qty] as sum([Measures].[Quantity - Stock])

select	{[measures].[count of existing records],
		[measures].[Stk Qty]} 
		on 0,
		[Item].[Item].&[393855 - Candlelight Soft Trousers]
		on 1
from [Retail]' 

Open in new window


However I get a #Error on my [count of existing measures] when I use the EXCLUDEEMPTY option on my count.  When I remove it I get a count, however it is of all locations.

Any help would be massively appreciated.

Cheers

Jon
0
Comment
Question by:McSsporran
[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
2 Comments
 
LVL 15

Accepted Solution

by:
Tim Humphries earned 500 total points
ID: 37762553
Hi Jon,

I suspect you're getting an infinite recursion error, as described here : http://msdn.microsoft.com/en-us/library/aa937471%28v=sql.80%29.aspx

Changing your Count measure to:

Count([Location].[Code].MEMBERS * {[Measures].DefaultMember]},  EXCLUDEEMPTY)

Open in new window


Should resolve the problem.

Also note that if the default aggregation on [Measures].[Quantity - Stock] is SUM (which it probably is - check your measure definition in your cube to determine this) then you don't need to define a measure to sum these values - this will be done for you by MDX.

So your full query should be:

with 
member [measures].[count of existing records] as Count([Location].[Code].MEMBERS * {[Measures].DefaultMember]}, EXCLUDEEMPTY)

select	{[measures].[count of existing records],
		[Measures].[Quantity - Stock]} 
		on 0,
		[Item].[Item].&[393855 - Candlelight Soft Trousers]
		on 1
from [Retail]

Open in new window


Tim
0
 

Author Closing Comment

by:McSsporran
ID: 37837970
Tim<br /><br />Thanks very much that worked a treat.<br /><br />Regards<br /><br />Jon
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS Parameters 10 43
Add a step to a system backup job 6 54
Enabling flash installation using GPO 2 53
Need more granular date groupings 4 44
A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

732 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