CUME_DIST

Calculates the cumulative distribution of a value in a group of values. That is, CUME_DIST computes the relative position of a specified value in a group of values. For a row r, assuming ascending ordering, the CUME_DIST of r is the number of rows with values lower than or equal to the value of r, divided by the number of rows evaluated in the partition or query result set.

Syntax

CUME_DIST( )
    OVER ( [ partition_by_clause ] order_by_clause )

Arguments

None.

Return types

float

Example

SELECT CUME_DIST() OVER(ORDER BY [IntColumn]) AS [ReturnValueCumeDist]
  FROM [IntTable]