Ranking functions

RANK 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 visualization.

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({metric/amount_won}) ASC WITHIN({attribute/date_closed.year})
SELECT RANK({metric/amount_won}) WITHIN(CURRENT)
SELECT RANK({metric/amount_won}) WITHIN(ALL OTHER)