RANK( value [ , direction ] [ TOTAL | WITHIN [ dim1, ... ] | AMONG [ dim1, ... ] ] )
Returns the rank of the current row if ordered by the given argument. Rows corresponding to the same value used for sorting have the same rank. If the first two rows both have rank of
1, then the next row (if it features a different value) will have rank
3, so, in effect, it is rank with gaps.
"desc" or omitted, then ranking is done from greatest to least, if
"asc", then from least to greatest.
Boolean | Date | Datetime | Number | String | UUID
Only constant values are accepted for arguments (direction).
RANK([Profit] WITHIN [Country])
RANK([Profit] AMONG [Date])
Data source support
Microsoft SQL Server 2017 (14.0),