MDX Error "Hierarchy already appears in the Axis0 axis"

mdx
user1750761 picture user1750761 · Oct 18, 2012 · Viewed 9.6k times · Source

In the following MDX queries

SELECT 
{
    [EffectiveDate].[Period].[All].CHILDREN, 
    [EffectiveDate].[Period].[All]
} ON COLUMNS, 
NON EMPTY {
    [Account].[Hierarchy].[Account Type].&[Assets].CHILDREN,
    [Account].[Hierarchy].[Account Type].&[Assets],
    [Account].[Hierarchy].[Account Type].&[Liabilities].CHILDREN,
    [Account].[Hierarchy].[Account Type].&[Liabilities],
    [Account].[Hierarchy].[Account Type].&[Equity].CHILDREN, 
    [Account].[Hierarchy].[Account Type].&[Equity],
    [Account].[Hierarchy].[Account Type].&[Revenue].CHILDREN, 
    [Account].[Hierarchy].[Account Type].&[Revenue],
    [Account].[Hierarchy].[Account Type].&[Expenses].CHILDREN,
    [Account].[Hierarchy].[Account Type].&[Expenses]
} ON ROWS 
FROM [JEMDA] 
WHERE CrossJoin(
    {
        [Measures].[Amount]
    }, 
    {
        [Source].[Source].[[Blank]]]
    }, 
    {
        [EffectiveDate].[Period].&[5-Dec],
        [EffectiveDate].[Period].&[5-Nov],
        [EffectiveDate].[Period].&[5-Oct],
        [EffectiveDate].[Period].&[6-Jan]
    })

It reports the error:

The Period hierarchy already appears in the Axis0 axis.

Can you tell me how to solve this issue? Thanks!

Answer

Benoit picture Benoit · Oct 18, 2012

You cannot use the Period hierarchy on columns AND on the slicer.

You may rewrite your query like this:

SELECT 
{
    [EffectiveDate].[Period].[All].CHILDREN, 
    [EffectiveDate].[Period].[All]
} ON COLUMNS, 
NON EMPTY 
{
    [Account].[Hierarchy].[Account Type].&[Assets].CHILDREN,
    [Account].[Hierarchy].[Account Type].&[Assets],
    [Account].[Hierarchy].[Account Type].&[Liabilities].CHILDREN,
    [Account].[Hierarchy].[Account Type].&[Liabilities],
    [Account].[Hierarchy].[Account Type].&[Equity].CHILDREN, 
    [Account].[Hierarchy].[Account Type].&[Equity],
    [Account].[Hierarchy].[Account Type].&[Revenue].CHILDREN, 
    [Account].[Hierarchy].[Account Type].&[Revenue],
    [Account].[Hierarchy].[Account Type].&[Expenses].CHILDREN,
    [Account].[Hierarchy].[Account Type].&[Expenses]
} ON ROWS 
FROM
 (
    SELECT {
                [EffectiveDate].[Period].&[5-Dec],
                [EffectiveDate].[Period].&[5-Nov],  
                [EffectiveDate].[Period].&[5-Oct],
                [EffectiveDate].[Period].&[6-Jan]
            } ON 0
  FROM [JEMDA]
)
WHERE 
(
[Measures].[Amount], 
[Source].[Source].[[Blank]]
)