Solved

Using the EXCLUDEEMPTY  in mdx count returns Error

Posted on 2012-03-23
2
950 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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