NON EMPTY  CROSSJOIN With Multiple Levels of a Single Dimenision

Posted on 2008-11-05
Last Modified: 2013-11-16
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])


Question by:RobDogg27
    1 Comment
    LVL 8

    Accepted 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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 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

    14 Experts available now in Live!

    Get 1:1 Help Now