These cookies provide us with information on how our websites are being used, to help us improve the quality and relevance of content we place on them. Additionally, they also allow us to show you embedded videos and remember your preferences and actions, so that the websites do not bother you with the same request repeatedly (e.g. filling a form to download a PDF file and provide feedback about such actions to our affiliated entities).
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)