percentile

Edit pageLast modified: 16 June 2025

Computes the specified percentile of values.

This is also called the "centile" or the 100-quantile.

The 25th percentile is also known as the first quartile (Q1), the 50th percentile as the median or second quartile (Q2), and the 75th percentile as the third quartile (Q3).

null values in the input are ignored. The operations either throw an exception when the input is empty (after filtering null or NaN values), or they return null when using the -orNull overloads.

All primitive numeric types are supported: Byte, Short, Int, Long, Float, and Double, but no mix of different number types. In these cases, the return type is always Double?. The results of the operation on these types are interpolated using Quantile Estimation Method R8.

The operation is also available for self-comparable columns (so columns of type T : Comparable<T>, like DateTime, String, etc.) In this case, the return type remains T?. The index of the result of the operation on these types is rounded using Quantile Estimation Method R3.

All operations on Double/Float have the skipNaN option, which is set to false by default. This means that if a NaN is present in the input, it will be propagated to the result. When it's set to true, NaN values are ignored.