Learning
Community
Open Exchange
Global Masters
InterSystems IRIS Data Platform 2019.3 / Application Development / InterSystems MDX Reference / Expression Types / Hierarchy Expressions
Previous section   Next section

Hierarchy Expressions

This section describes how to create and use hierarchy expressions in InterSystems MDX.

Details

In InterSystems MDX, a hierarchy expression has one of the following forms:
  • A hierarchy literal, which is a direct reference to the hierarchy as follows:
    [dimension_name].[hierarchy_name]
    
    Where:
    For example:
    [gend].[h1]
    
  • A reference to a dimension:
    [dimension_name]
    
    For example:
    [gend]
    
    The system interprets this as a reference to the first visible hierarchy of that dimension.
  • An expression that uses an InterSystems MDX extension to refer to a hierarchy in another cube, via the following syntax:
    [relationship_name].hierarchy_expression
    
    Where relationship_name is the name of a relationship in the cube used by the query and hierarchy_expression refers to a hierarchy contained in that relationship.

Uses

A bare hierarchy expression returns all records; this expression is equivalent to an All member. (Note that you can use a bare hierarchy expression even if the dimension does not formally define an All level.) For example:
SELECT MEASURES.[%count] ON 0, colord.h1 ON 1 FROM patients
 
                             Patient Count
                                      1,000
Also, you can use a hierarchy expression as an argument to any of the following functions:
Previous section   Next section