Page tree


Contents:

Scheduled Maintenance: docs.trifacta.com will be offline for maintenance at 3:00pm UTC on Tuesday March 28 for about 15 minutes.

   

This example demonstrates you to generate a ranked order of values.

Functions:

ItemDescription
RANK Function 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 the number of tie values.
DENSERANK Function 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.

Source:

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.

RunnerLapTime
Dave172.2
Dave273.31
Dave372.2
Dave470.85
Mark171.73
Mark271.73
Mark372.99
Mark470.63
Tom174.43
Tom270.71
Tom371.02
Tom472.98


Transformation:

You can apply the RANK() function to the Time column, grouped by individual runner:

Transformation Name Window
Parameter: Formulas RANK()
Parameter: Group by Runner
Parameter: Order by Time

You can use the DENSERANK() function on the same column, grouping by runner:

Transformation Name Window
Parameter: Formulas DENSERANK()
Parameter: Group by Runner
Parameter: Order by Time

Results:

After renaming the columns, you have the following output:

RunnerLapTimeRankRank-Dense
Mark470.6311
Mark171.7322
Mark271.7322
Mark372.9943
Tom270.7111
Tom371.0222
Tom472.9833
Tom174.4344
Dave470.8511
Dave172.222
Dave372.222
Dave273.3143

See Also for EXAMPLE - RANK Functions:

This page has no comments.