PERCENTILE Function | Teradata Vantage - PERCENTILE - Analytics Database - Teradata Vantage

Time Series Tables and Operations

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
2023-10-30
dita:mapPath
tuc1628112453431.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
sfz1493079039055
lifecycle
latest
Product Category
Teradata Vantageā„¢

Returns the value which represents the desired percentile from each group. PERCENTILE is a single-threaded function.

To invoke the time series version of this function, use the GROUP BY TIME clause. For more information, see GROUP BY TIME Clause.

Return Values

This function returns the REAL data type.

Nulls are not included in the result computation.

The result value is determined by the desired index (di) in an ordered list of values. The following equation is for the di:

di = (number of values in group - 1) * percentile/100

When di is a whole number, that value is the returned result. The di can also be between two data points, i and j, where i<j. In this case, the result is interpolated according to one of the following schemes:
  • Linear interpolation. The result value is computed using the following equation:

    result = i + (j - i) * (di/100)MOD 1

    Specify by using the optional interpolation parameter with a value of LINEAR. LINEAR is the default scheme for interpolation.

  • Low value. The result value is equal to i. Specify by using the optional interpolation parameter with a value of LOW.
  • High value. the result value is equal to j. Specify by using the optional interpolation parameter with a value of HIGH.
  • Nearest value. The result value is i if (di/100 )MOD 1 <= .5; otherwise, it is j. Specify by using the optional interpolation parameter with a value of NEAREST.
  • Midpoint. The result value is equal to (i+j)/2. Specify by using the optional interpolation parameter with a value of MIDPOINT.

Usage Notes

PERCENTILE is valid only for numeric data.