Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using the EXCLUDEEMPTY  in mdx count returns Error

Posted on 2012-03-23
2
Medium Priority
?
972 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 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

971 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