[Mondrian] Attribute Hierarchy Member MDX
Julian Hyde
jhyde at pentaho.com
Mon Apr 9 12:57:40 EDT 2012
On Apr 9, 2012, at 9:06 AM, Benny Chow wrote:
What does a member from an attribute hierarchy look like in MDX for the scenario we talked about on the call. I.e. Portland by itself vs. Portland in Maine vs. Portland in Oregon.
An attribute hierarchy is the same as a regular hierarchy that has one level, and that level has the same name as the hierarchy. It may or may not have an 'all' member. There is no 'magic'. So:
1. A hierarchy query
select [Customer].[City Name].Members on 0
from [Sales]
[Customer] is the dimension
[City Name] is the hierarchy
2. A level query
select [Customer].[City Name].[City Name].Members on 0
from [Sales]
Attribute hierarchies have only one level, with the same name as the hierarchy. The 2nd query returns the same as the first, except that it doesn't yield the 'All member'.
Look again at query #1 and you see that it is ambiguous if ssas-compatible-naming is false. Is it asking for a level or a hierarchy? That's why we only support ssas-compatible-naming=true in mondrian-4.
How you reference the member depends on its key.
3a. Member query, assuming that City Name is composite.
select [Customer].[City Name].&Portland&ME&USA on 0
from [Sales]
3b. Member query, assuming that City Name is not composite.
select [Customer].[City Name].&Portland on 0
from [Sales]
or indeed
select [Customer].[City Name].[Portland] on 0
from [Sales]
would work because Portland is both the name and the key.
4. Cartesian member query
select [Customer].[Nation].Members * [Customer].[State].Members * [Customer].[City Name].[Portland] on 0
from Sales
because of 'auto-exists', only [Customer[.Nation].[USA] and {[Customer].[State].[OR], [Customer].[State].[ME]} will appear.
(Cc:ing mondrian developers. This gets to the heart of "what's different in mondrian 4".)
Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20120409/2305464b/attachment.html
More information about the Mondrian
mailing list