SQL Flow Field Guide

PERCENT_RANK

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

PERCENT_RANK( ) OVER ( [ partition_by_clause ] order_by_clause )

Work example

Compare the current rank position with its ordered partition.

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

Check your work A one-row partition returns zero and ties share a rank position.

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