CUME_DIST()
For SQL Server, this function calculates the cumulative distribution of a value within a group of values. In other words, `CUME_DIST` calculates the relative position of a specified value in a group of values. Assuming ascending ordering, the `CUME_DIST` of a value in row _r_ is defined as the number of rows with values less than or equal to that value in row _r_, divided by the number of rows evaluated in the partition or query result set. `CUME_DIST` is similar to the `PERCENT_RANK` function.
Signature
CUME_DIST( )
OVER ( [ partition_by_clause ] order_by_clause )Examples
SELECT product, amount, CUME_DIST() OVER (ORDER BY amount) AS cd FROM dbo.orders;product amount cd
---------------------------------------- ------------ ------------------------
cable 15.00 0.16666666666666666
mouse 27.75 0.33333333333333331
keyboard 49.50 0.5
keyboard 99.00 0.66666666666666663
monitor 219.00 0.83333333333333337
monitor 438.00 1.0Run against SQL Server 16.0.4265.3 on 2026-09-13. This is the output we got, not the documentation’s.
Available on
- SQL Server 2017 and later
- Azure SQL Database
- Azure SQL Managed Instance
- Azure Synapse Analytics
- Microsoft Fabric warehouse
- Fabric SQL database
Signature and description adapted from the Microsoft SQL documentation, used under the CC BY 4.0. SQL Server and Azure are trademarks of the Microsoft group of companies. This page is not affiliated with Microsoft.