[Mondrian] [MDX] How to find the current hierarchy

Julian Hyde jhyde at pentaho.com
Thu Dec 22 13:12:42 EST 2011


Every hierarchy always has a current member. Even hierarchies you are "not using". So there's no such thing as "the current hierarchy of dimension D".

On Dec 22, 2011, at 9:27 AM, Pedro Alves wrote:

> 
> I'm clueless here. I have D with H1 (default hierarchy) and H2. How can 
> I know / query the hierarchy I'm querying without knowing it?
> 
> 
> 1. With member [Measures].[currentHierarchy] as
> 2. [D].currentMember.hierarchy.name
> 3. select Union( [D].children, [D.H2].children, ALL ) on 0
> 4. [Measures].[currentHierarchy] on 1
> 5. from [foo]
> 
> 
> The above query returns the default hierarchy for D. If I change line 2. 
> to [D.H2].currentMember.hierarchy.name, then I'll get "H2" everywhere.
> 
> 
> Isn't there a way to find something like "currentHierarchy"? What's the 
> best approach to this?
> 
> 
> 
> -pedro
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian



More information about the Mondrian mailing list