Reputation: 5
I have a column with numbers. I already calculated the percentiles using percentile_cont. How can I sum up/count all the rows (& calculate their %) that fall below, e.g. the 25th percentile?
Upvotes: 0
Views: 272
Reputation: 1
You can use ROW_NUMBER Example:
ROW_NUMBER() OVER (
[PARTITION BY expr1, expr2,...]
ORDER BY expr1 [ASC | DESC], expr2,...
)
SELECT ROW_NUMBER() OVER (Order by Id) AS RowNumber, Field1, Field2, Field3 FROM User
https://learn.microsoft.com/it-it/sql/t-sql/functions/row-number-transact-sql?view=sql-server-ver15
Upvotes: 0