Returns members of a set in their hierarchical order as represented in the database outline.
Syntax
Hierarchize ( set [,POST] )
Parameter | Description |
---|---|
Set specification. | |
POST | If this keyword is used, child members are returned before their parents. |
Notes
This function returns members of a set in their hierarchical order as represented in the database outline (viewed from top-down by default, meaning that parent members are returned before their children).
If POST is used, child members are returned before their parents (the view changes to bottom-up). For example,
Hierarchize({Child, Grandparent, Parent})
returns {Grandparent, Parent, Child}.
Hierarchize({Child, Grandparent, Parent}, POST)
returns {Child, Parent, Grandparent}.
Example
The following expression
Hierarchize({May, Apr, Jun})
returns the set:
{Apr, May, Jun}
Therefore, the following query
Select Hierarchize({May, Apr, Jun}) on columns from sample.basic
returns the grid:
Apr | May | Jun |
---|---|---|
8644 | 8929 | 9534 |
The following expression
Hierarchize({May, Qtr2, Apr, Jun})
returns the set:
{ Qtr2 Apr May Jun }
Therefore, the following query
Select Hierarchize({May, Qtr2, Apr, Jun}) on columns from sample.basic
returns the grid:
Qtr2 | Apr | May | Jun |
---|---|---|---|
27107 | 8644 | 8929 | 9534 |
The following expression
Hierarchize({May, Qtr2, Apr, Jun}, POST)
returns the set:
{Apr, May, Jun, Qtr2}
Therefore, the following query
Select Hierarchize({May, Qtr2, Apr, Jun}, POST) on columns from sample.basic
returns the grid:
Apr | May | Jun | Qtr2 |
---|---|---|---|
8644 | 8929 | 9534 | 27107 |
The following query
Select Hierarchize({Dec, Year, Feb, Apr, Qtr1, Jun, Qtr2}, POST) on columns, Hierarchize({Margin, Sales}) on rows from sample.basic
returns the grid:
(axis) | Feb | Qtr1 | Apr | Jun | Qtr2 | Dec | Year |
---|---|---|---|---|---|---|---|
Margin | 17762 | 52943 | 18242 | 19457 | 56317 | 18435 | 221519 |
Sales | 32069 | 95820 | 32917 | 35088 | 101679 | 33342 | 400855 |