PERCENT_RANK Function Examples | Teradata Vantage - Example: Relative Rank - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

Determine the relative rank, called the percent_rank, of Christmas sales.

The following query:

   SELECT sales_amt, 
   PERCENT_RANK() OVER (ORDER BY sales_amt)
   FROM xsales;

might return the following results. Note that the relative rank is returned in ascending order, the default when no sort order is specified and that the currency is not reported explicitly.

sales_amt Percent_Rank
100.00 0.000000
120.00 0.125000
130.00 0.250000
140.00 0.375000
143.00 0.500000
147.00 0.625000
150.00 0.750000
155.00 0.875000
160.00 1.000000