473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

is this a bad way to do percentile

Normally when people ask about getting the Nth percentile from a group,
the response is to write a couple of VBA modules. But it seems to me
there's a simpler way that just uses 2 queries. You might even be able
to get it down to one query if you nest them.

Here's how I get the 25th percentile number from a table, where
mynumber is the field that has the value and mytable is the table name:

top_25_query:
select top 25 percent mynumber from mytable order by mynumber;

25th_percentile_query:
select top 1 mynumber from top_25_query order by mynumber desc;

This seems more portable to me and easier for non-scripters to
understand.

Is there any reason that this would be a wrong way to do it? Will it
give me the wrong answer? It hasn't yet.

Thanks

Nov 13 '05 #1
2 3269

"jd142" <jd***@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Normally when people ask about getting the Nth percentile from a group,
the response is to write a couple of VBA modules. But it seems to me
there's a simpler way that just uses 2 queries. You might even be able
to get it down to one query if you nest them.

Here's how I get the 25th percentile number from a table, where
mynumber is the field that has the value and mytable is the table name:

top_25_query:
select top 25 percent mynumber from mytable order by mynumber;

25th_percentile_query:
select top 1 mynumber from top_25_query order by mynumber desc;

This seems more portable to me and easier for non-scripters to
understand.

Is there any reason that this would be a wrong way to do it? Will it
give me the wrong answer? It hasn't yet.

Thanks

What if there is more than 1 record with the 25th percentile mynumber?

Nov 13 '05 #2
Since I only what the number, not who has that number, it shouldn't
make a difference.

In other words, I don't care that on their final exam, John, Jane,
Richard, and Alice all scored a 32, I just care that 32 is the score at
the 25th percentile.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Indraneel Sheorey | last post by:
Hello, I want to set up a query in SQL Server that is "grouped by" a variable PRICE. Since PRICE takes on continuous decimal values, I want to create deciles based on this variable and then...
2
by: cowboyboborton | last post by:
Looking for some help here. I've tried to solve this, but I just can't. What I need to know is what formula to use in an excel calculation to complete the following calculation. It's in two...
3
by: Dave Veeneman | last post by:
I'm looking from an algorithm that will do a statistics calculation for me-- it's the first time 'Numerical Recipies in C' has failed me! A normal distribution table tells me the probability (by...
1
by: Joe | last post by:
Has anyone written a percentile rank algorithm that they can share or know of a good resource that defines the algorithm. I'm starting a project that involves percentile ranks, logistic and linear...
8
by: Kapil Jain | last post by:
Dear All, I have score table in which i am storing scores for online quiz what i want is to allot rank to all candidates as per their scores for that i applied logic that i sorted table order by...
7
by: steveyjg | last post by:
This is my first post so I'm not sure if this should be in the .NET forum or the VB forum. Anyway I'm using VB .NET and trying to call the Percentile function. The function needs an Object as a...
28
by: riaane | last post by:
Hey clever people, Excel has the =PERCENTILE function. This calulates a percentile value from an array of values. Is there any equivalent in Access?
5
by: artemetis | last post by:
Hello! It's me again. tblEmp -->empUid - self explanatory -->empPerf - ranking from 0 - 100 I'm interested in creating a query that displays the top x% (eg, 20%) of employee performance,...
19
by: SachinPatel | last post by:
ADezii, i have been reading your solution to this percentile problem and believe you can help me. I have a similar problem with creating a percentile in access 2007. My table is called...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.