• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1439
  • Last Modified:

NON EMPTY CROSSJOIN With Multiple Levels of a Single Dimenision

I need to do a NON EMPTY  CROSSJOIN where I need to return data from multiple levels of 2 dimensions.  When I try to run this, I get this error "Formula Error - duplicate dimension across (independent) axes in a <set> ..."  An example of the structure is below:

SELECT {[Measures].[Sales],[Measures].[Transactions]} on columns ,    
NON EMPTY  CROSSJOIN(CROSSJOIN({[Region].[Level 1].Members},  {[Region].[Level 2].Members}  ), {[Region].[Level 3].Members})
ON rows  
WHERE ([Time].[2008].[Quarter 4].[October].[1])


1 Solution
Better to use parent (or parent.parent) and a local calculation to get the name of parent. Simple solution that has minimal performace overhead and you get what you want - names of the levels for some members of the same hierarchy.
with member measures.CategoryName
[Product].[Product Categories].CurrentMember.Parent.Parent.Name
member measures.SubcategoryName
[Product].[Product Categories].CurrentMember.Parent.Name
select {measures.CategoryName, measures.SubcategoryName, measures.defaultmember} on columns,
[Product].[Product Categories].[Product Name].&[456] on rows
from [Adventure Works]

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now