The ranking functions return a numerical rank for each of a report's metric values in ascending [ASC] order (smallest value ranked first) or descending [DESC] order (largest value ranked first). Ascending order is the default, for cases where an order is not explicitly specified.
A key feature of the ranking functions is the WITHIN Clause keyword, which allows you to carry out rankings of multiple attribute subgroups within a single report.
Syntax (applies to all supported Rank Variations)
SELECT RANK(…) [ASC | DESC] [WITHIN(…)]*
SELECT RANK(metric) WITHIN(CURRENT)
SELECT RANK(metric) WITHIN(attribute1, attribute2, [...])
SELECT RANK(metric) WITHIN(attribute ALL OTHER | ALL OTHER EXCEPT FOR...)
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: