Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 CURRENTMEMBER issue

Author  Topic 

nicklarge
Starting Member

40 Posts

Posted - 2011-08-31 : 16:56:37
Hello.

I am executing the following query and recieve an error:

WITH MEMBER [Measures].[Number Of Kids]
AS
DISTINCTCOUNT([Process Date Fiscal Calendar].CURRENTMEMBER.CHILDREN)
SELECT {[Measures].[Sales Dollar Amount],
[Measures].[Number Of Kids]} ON COLUMNS
FROM [Admin User]

When the query is executed, I get the sales dollar amount, but for "Number of Kids" I get #Error. When I move my cursor over the "Number Of Kids" cell, I see a tooltip with the following text:

Query (3, 15) : The "Process Date Fiscal Calendar" dimension contains more than on hierarchy, therefore the hierarchy must be explicitly specified.

I am reading "MDX Solutions" and see that most of the examples use CURRENTMEMBER at the dimension level. Any ideas how to solve this? I tried disabling the hierarchies in the time dimension, but that is not a solution.

Thanks, Nick.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-01 : 00:12:04
when you're telling it to retrive CURRENTMEMBER you need to specify which hierarchy you want it to applied to as it has more than 1. so specify like

DISTINCTCOUNT([Process Date Fiscal Calendar].[Your required hierarchy Here].CURRENTMEMBER.CHILDREN)


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

nicklarge
Starting Member

40 Posts

Posted - 2011-09-01 : 11:20:22
Thanks Visakh, however, if you look at examples like the one at this link http://www.databasejournal.com/features/mssql/article.php/10894_2215141_3/MDX-Essentials-MDX-Member-Functions-Relative-Member-Functions.htm you will see code like:
WITH
MEMBER [Measures].[Warehouse Margin] AS
'([Time].CurrentMember , [Measures].[Warehouse Sales])-
([Time].Currentmember, [Measures].[Warehouse Cost])'
SELECT
{(Time.CurrentMember)} ON COLUMNS,
{([Warehouse].[Country].USA)} ON ROWS
FROM Warehouse
WHERE ([Measures].[Warehouse Margin])

which cannot work using the answer you gave because [Time].CurrentMember would not work. Did something change to MDX/SSAS since the post in the link was written? This is why I am confused here.

Thanks, Nick.
Go to Top of Page
   

- Advertisement -