Computes the rank of an ordered set of value within groups. Tie values are assigned the same rank, and the next ranking is incremented by 1.
Rank values start at
Ranking order varies depending on the data type of the source data. For more information, see Sort Order.
You must use the
orderparameters to define the groups of records and the order of those records to which this transform is applied.
- This function works with the following transforms:
- This function assigns ranking of the next value of a set of ties as a single increment more. For more discrete ranking, see RANK Function.
Output: Generates the new column, which contains the ranking of
Times values, grouped by the
For more information on the
group parameters, see Window Transform.
For more information on syntax standards, see Language Documentation Syntax Notes.
Example - Rank Functions
This example demonstrates the following two functions:
RANK- Generates a ranked order of values, ranked within a group.
- If there are three tie values in a group, the next ranking is three more than the tie values.
- See RANK Function.
DENSERANK- Generates a ranked order of values, ranked within a group.
- If there are three tie values in a group, the next ranking is one more than the tie values.
- See DENSERANK Function.
The following dataset contains lap times for three racers in a four-lap race. Note that for some racers, there are tie values for lap times.
You can apply the
RANK() function to the
Time column, grouped by individual runner:
You can use the
DENSERANK() function on the same column, grouping by runner:
After renaming the columns, you have the following output:
This page has no comments.