SQL Flow Field Guide

CUME_DIST

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

window analytic

What changes

Input
ordered rows of the partition (frame for FIRST_VALUE/LAST_VALUE; offset rows for LAG/LEAD)
Output or change
one value per row
Return type
float(53)

Syntax at a glance

CUME_DIST( ) OVER ( [ partition_by_clause ] order_by_clause )

Work example

Find the fraction of ordered rows at or below the current peer group.

Test a tie, partition boundary, and one-row partition. State the order and frame in the query.

Check your work Tied values share a result and the cumulative distribution ranges from above zero to one.

Open Microsoft Learn for full syntax, permissions, and details for your version.