SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Percentile Calculation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jcb267
Posting Yak Master

USA
238 Posts

Posted - 10/05/2012 :  11:48:40  Show Profile  Reply with Quote
Hi ~

Is it possible to calculate percentiles in sql as in excel? I have a range of scores and I would like to determine who is in the top 10%, mid 50%, etc.

If so, how can it be done?

Thanks!



sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/05/2012 :  12:14:35  Show Profile  Reply with Quote
Excel uses different calculations based on whether a given value is in the dataset or not. If you want to reproduce the same behavior in SQL, take a look at this article, they the formulas, description and example code: http://www.sqlmag.com/article/tsql3/calculate-percentiles Both approaches use rank/dense_rank functions.
Go to Top of Page

jcb267
Posting Yak Master

USA
238 Posts

Posted - 10/05/2012 :  12:26:53  Show Profile  Reply with Quote
OK, thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000