Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jcb267
Constraint Violating Yak Guru

USA
291 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
Constraint Violating Yak Guru

USA
291 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  
 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.05 seconds. Powered By: Snitz Forums 2000