Percentile_Cont (Azure Stream Analytics)

 

Published: September 8, 2016

Updated: September 8, 2016

Applies To: Azure

Calculates a percentile based on a continuous distribution of the entire data set. The result is interpolated and might not be equal to any of the specific values from the input set.

Syntax

PERCENTILE_CONT ( numeric_literal )
      OVER ( ORDER BY order_by_expression [ ASC | DESC ] )

numeric_literal

The percentile to compute. The value must range between 0 and 1.

OVER ( ORDER BY order_by_expression [ ASC | DESC] )

Specifies a list of numeric values to sort and compute the percentile over. Only one order_by_expression is allowed. The expression must evaluate to a numeric type. Other data types are not allowed. The default sort order is ascending.

Float

The following example uses PERCENTILE_CONT to find the 95th percentile of service availability across regions. Note that the function may not return a percentile that is within the input data set. This is because PERCENTILE_CONT interpolates the appropriate value, whether or not it exists in the data set.

SELECT PERCENTILE_CONT(0.95) OVER (ORDER BY serviceAvailability)
FROM testInput
GROUP BY SlidingWindow(hours, 1)

Example input:

RegionsServiceAvailability
A0.98
B0.93
C0.78
D0.99
E0.89

Example output:

0.988

Show: