Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

"The dimension '<named set alias>' was not found in the cube when the string, <named set alias>, was parsed" error when you execute an MDX query in SQL Server 2012 Analysis Services


View products that this article applies to.

Symptoms

When you try to run a Multidimensional Expressions (MDX) query in Microsoft SQL Server 2012 Analysis Services (SSAS), you receive an error message that resembles the following:
The dimension '<named set alias>' was not found in the cube when the string, <named set alias>, was parsed.

Notes
  • "Named set alias" is a placeholder for the dynamic name that you defined for the dimension.
  • The MDX query is executed successfully in SSAS 2008 R2.

For example, you receive the error message when you execute the following query against the AdventureWorks SQL Server 2008 R2 database in SSAS 2012:
WITH 
SET XQE_NS10 AS
Filter
(
[Product].[Product Categories].[Category].MEMBERS
,
Count
(
Filter
(
CrossJoin
(
[Product].[Product Categories].[Category].MEMBERS
,[Product].[Status].[Status].MEMBERS
)
,
(
[Measures].[Reseller Freight Cost]
,[Date].[Fiscal].[XQE_MDF_CM0]
)
> 20000
)
,IncludeEmpty
)
> 0
)


/* The named set [XQE_SA0] is defined in context of the COUNT operation */

MEMBER [Date].[Fiscal].[XQE_MDF_CM0] AS
IIF
(
Count
(
Descendants
(
[Geography].[Geography].CurrentMember
,[Geography].[Geography].[Country]
) AS [XQE_SA0]
,IncludeEmpty
)
> 0
,Aggregate

/* [XQE_SA0] is subsequently used in AGGREGATE */
(
[XQE_SA0]
,[Date].[Fiscal].DefaultMember
)
,NULL
)
SET XQE_NS0 AS
[Geography].[Geography].[Country].&[Canada]
SELECT
{XQE_NS0} ON 0
FROM [AdventureWorks]
WHERE
[Measures].[Reseller Freight Cost];

↑ Back to the top


Cause

This issue occurs because an alias that is defined in a specific scope cannot be referenced outside the scope in SSAS 2012.

Note The scope leak is enabled in SSAS 2008 R2. However, it is disabled in SSAS 2012.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Workaround

To work around this issue, use one of the following methods to avoid referencing an alias that is outside its defined scope in an MDX query in SSAS 2012.

Method 1

Reference the alias within its defined scope.

Method 2

Use a duplicate MDX expression that represents the alias. For example, to work around the problem in the situation described in the "Symptoms" section, you can replace the [XQE_SA0] alias with the following expression:
([Geography].[Geography].CurrentMember,[Geography].[Geography].[Country])
Now, the following code will run successfully:
WITH 
SET XQE_NS10 AS
Filter
(
[Product].[Product Categories].[Category].MEMBERS
,
Count
(
Filter
(
CrossJoin
(
[Product].[Product Categories].[Category].MEMBERS
,[Product].[Status].[Status].MEMBERS
)
,
(
[Measures].[Reseller Freight Cost]
,[Date].[Fiscal].[XQE_MDF_CM0]
)
> 20000
)
,IncludeEmpty
)
> 0
)
MEMBER [Date].[Fiscal].[XQE_MDF_CM0] AS
IIF
(
Count
(
Descendants
(
[Geography].[Geography].CurrentMember
,[Geography].[Geography].[Country]
) AS [XQE_SA0]
,IncludeEmpty
)
> 0
,Aggregate
(
Descendants
/* instead of referencing [XQE_SA0], substitute the MDX upon which it is based */
(
[Geography].[Geography].CurrentMember
,[Geography].[Geography].[Country]
)
,[Date].[Fiscal].DefaultMember
)
,NULL
)
SET XQE_NS0 AS
[Geography].[Geography].[Country].&[Canada]
SELECT
{XQE_NS0} ON 0
FROM [AdventureWorks]
WHERE
[Measures].[Reseller Freight Cost];

↑ Back to the top


References

For more information about the AdventureWorks database for SQL Server 2008 R2, go to the following Microsoft CodePlex website:

↑ Back to the top


Keywords: kbtshoot, kbsurveynew, kbexpertiseadvanced, kb

↑ Back to the top

Article Info
Article ID : 2739928
Revision : 1
Created on : 1/7/2017
Published on : 11/19/2012
Exists online : False
Views : 384