![]() Previous |
![]() Next |
HIER_ORDER sorts the members of a dimension with children immediately after their parents, and returns a sequential number for each member.
Syntax
HIER_ORDER ( [member_expression] [WITHIN] {DIMENSION dimension_id | HIERARCHY hierarchy_id} )
Arguments
member_expression
Identifies a single dimension member within the hierarchy used for the calculation. If this optional argument is specified, then the result does not vary across dimension members.
dimension_id
The dimension over which the values are calculated using the default hierarchy.
hierarchy_id
The hierarchy over which the values are calculated. If dimension_id is used instead, the default hierarchy is used.
Example
This example orders the values of the Time dimension:
HIER_ORDER(DIMENSION "TIME")
| Time | Order |
|---|---|
| 2006 | 138 |
| Q1.06 | 139 |
| JAN-06 | 140 |
| FEB-06 | 141 |
| MAR-06 | 142 |
| Q2.06 | 143 |
| APR-06 | 144 |
| MAY-06 | 145 |
| JUN-06 | 146 |
| Q3.06 | 147 |
| JUL-06 | 148 |
| AUG-06 | 149 |
| SEP-06 | 150 |
| Q4.06 | 151 |
| OCT-06 | 152 |
| NOV-06 | 153 |
| DEC-06 | 154 |
The next example returns 78 as the order number of Business World in the Market hierarchy of the Customer dimension.
HIER_ORDER('BUSN WRLD' WITHIN HIERARCHY CUSTOMER.MARKET)