Solved

Using the EXCLUDEEMPTY  in mdx count returns Error

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sql Permission 6 43
How can I group these transactions? 7 36
STDEVP in SQL 2 36
Record extraction 3 14
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now