You are viewing our older product's guide. Click here for the documentation of GoodData Cloud, our latest and most advanced product.
Rank
Ranking function returns a numerical rank for metric values in ascending, default, order (the smallest value ranked first) or descending order (the largest value ranked first).
A key feature of the ranking functions is WITHIN Clause that allows you to carry out rankings of multiple attribute subgroups within a single report.
Syntax
The following syntax applies to all supported Rank Variations.
SELECT RANK(…) [ASC | DESC] [WITHIN(…)]*
SELECT RANK(metric)
SELECT RANK(metric) WITHIN(CURRENT)
SELECT RANK(metric) WITHIN(attribute1, attribute2, [...])
SELECT RANK(metric) WITHIN(attribute ALL OTHER | ALL OTHER EXCEPT FOR...)
Examples
The following examples apply to all supported Rank Variations.
SELECT RANK(Avg. Won)
SELECT RANK(Amount_Won) ASC WITHIN(Year(Closed))
SELECT RANK(Amount_Won) WITHIN(CURRENT)
SELECT RANK(Amount_Won) WITHIN(ALL OTHER)
Select from the following topics to get more information: