List.Percentile

List.Percentile is a Power Query M function that calculates one or more sample percentiles of a list based on the specified percentiles and interpolation method. The function returns a single value or a list of percentiles corresponding to the input probability.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

List.Percentile(
   list as list,
   percentiles as any,
   optional options as nullable record,
) as any

Description

Returns one or more sample percentiles of the list list. If the value percentiles is a number between 0.0 and 1.0, it will be treated as a percentile and the result will be a single value corresponding to that probability. If the value percentiles is a list of numbers with values between 0.0 and 1.0, the result will be a list of percentiles corresponding to the input probability. The PercentileMode option in options can be used by advanced users to pick a more-specific interpolation method but is not recommended for most uses. Predefined symbols PercentileMode.ExcelInc and PercentileMode.ExcelExc match the interpolation methods used by the Excel functions PERCENTILE.INC and PERCENTILE.EXC. The default behavior matches PercentileMode.ExcelInc. The symbols PercentileMode.SqlCont and PercentileMode.SqlDisc match the SQL Server behavior for PERCENTILE_CONT and PERCENTILE_DISC, respectively.

Examples

Find the first quartile of the list {5, 3, 1, 7, 9}.

// Output: 3
List.Percentile( {5, 3, 1, 7, 9}, 0.25 )

Find the quartiles of the list {5, 3, 1, 7, 9} using an interpolation method matching Excel’s PERCENTILE.EXC.

// Output: {2, 5, 8}
List.Percentile( {5, 3, 1, 7, 9}, {0.25, 0.5, 0.75}, [PercentileMode=PercentileMode.ExcelExc] )

Other functions related to List.Percentile are:

BI Gorilla Youtube Channel

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/list-percentile
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.