Ranks hierarchy members within a level based on measure values.
The template presents an attribute dimension the analytic view is dimensioned by, a hierarchy that uses the attribute dimension, a measure of the analytic view, a ranking function, a level of the hierarchy, the order of values, and the order of NULL values. To select a different value, click the underlined value in the template and make a selection from the Select Measures dialog box or the drop-down list.
Template
Rank members of the attribute dimension attribute dimension and the hierarchy hierarchy based on the measure measure using the { RANK | DENSE_RANK | AVERAGE_RANK } function over the level level in { highest to lowest | lowest to highest } order with NA (null) values ranked { nulls last | nulls first }.
Example: Example of Rank
The units_rank calculated measure function ranks geography hierarchy members within a level based on units.
Calculation in Template
Rank members of the GEOGRAPHY_ATTR_DIM attribute dimension and the GEOGRAPHY_HIER hierarchy based on the UNITS measure using the RANK function over the member’s level level in highest to lowest order with NA (null) values ranked nulls last.
Definition of Calculated Measure in Analytic View
The MEASURES clause of the SALES_AV analytic view definition includes this definition of the units_rank calculated measure:
units_rank AS
RANK () OVER (HIERARCHY GEOGRAPHY_ATTR_DIM.GEOGRAPHY_HIER
ORDER BY UNITS DESC NULLS LAST
WITHIN LEVEL)
SELECT Statement Using the Calculated Measure
Query the analytic view, selecting geography_hier and time_hier hierarchy members, units, and the rank of units for the region and year levels.
SELECT GEOGRAPHY_ATTR_DIM.GEOGRAPHY_HIER.member_caption AS "GEOGRAPHY",
TIME_ATTR_DIM.TIME_HIER.member_caption AS "TIME",
UNITS as "UNITS",
UNITS_RANK as "RANK"
FROM SALES_AV HIERARCHIES(GEOGRAPHY_ATTR_DIM.GEOGRAPHY_HIER,
TIME_ATTR_DIM.TIME_HIER)
WHERE (GEOGRAPHY_ATTR_DIM.GEOGRAPHY_HIER.level_name = 'REGION') AND
(TIME_ATTR_DIM.TIME_HIER.level_name = 'YEAR')
ORDER BY
UNITS_RANK,
GEOGRAPHY_ATTR_DIM.GEOGRAPHY_HIER.hier_order,
TIME_ATTR_DIM.TIME_HIER.hier_order;
Results of the Query
GEOGRAPHY TIME UNITS RANK ------------- ------ -------- ---- Asia CY2011 11214423 1 Asia CY2012 11190772 1 Asia CY2013 11191743 1 Asia CY2014 11195321 1 Asia CY2015 11225590 1 South America CY2011 4785946 2 South America CY2012 4773592 2 South America CY2013 4777408 2 South America CY2014 4776610 2 South America CY2015 4790599 2 North America CY2011 4116015 3 North America CY2012 4101302 3 North America CY2013 4101865 3 North America CY2014 4095936 3 North America CY2015 4108580 3 Africa CY2011 2524780 4 Africa CY2012 2518508 4 Africa CY2013 2520180 4 Africa CY2014 2516559 4 Africa CY2015 2528281 4 Europe CY2011 1735627 5 Europe CY2012 1730874 5 Europe CY2013 1730578 5 Europe CY2014 1732858 5 Europe CY2015 1736583 5 Oceania CY2011 85653 6 Oceania CY2012 85571 6 Oceania CY2013 85485 6 Oceania CY2014 85382 6 Oceania CY2015 85573 6 30 rows selected.