Hey,
I have a table with a group of speeds by date, Like so . . .
24/06/2004 12:00 47
24/06/2004 13:00 64
24/06/2004 14:00 53
25/06/2004 12:00 55
25/06/2004 13:00 55
26/06/2004 12:00 56
26/06/2004 13:00 55
26/06/2004 14:00 45
I want to calculate the 85th percentile for each date (for a specified period of time), of course there are more hours and dates in the original table but the above is just an overview (didn't want to paste 14,000 records up
). Anyway, my query so far is like the follow. . . .
The code after transform is incorrect, I just want to know how I would go about doing it in SQL in access or possibly in VBA.
I want the query to output data like this . . .
ie. between 12:00 and 14:00
RecordDate 85th Percentile
24/06/2004 60.7
25/06/2004 55
26/06/2004 55.7
This is easily done in excel, but not so in access.
Any help would be great guys
I have a table with a group of speeds by date, Like so . . .
24/06/2004 12:00 47
24/06/2004 13:00 64
24/06/2004 14:00 53
25/06/2004 12:00 55
25/06/2004 13:00 55
26/06/2004 12:00 56
26/06/2004 13:00 55
26/06/2004 14:00 45
I want to calculate the 85th percentile for each date (for a specified period of time), of course there are more hours and dates in the original table but the above is just an overview (didn't want to paste 14,000 records up
Code:
TRANSFORM ((((Sum(SpeedImport.Speed))-1)*0.85)+1)-Int((((Sum(SpeedImport.Speed)-1)*0.85)+1)) AS percentile
SELECT SpeedImport.RecordDate
FROM (Direction INNER JOIN Headers ON Direction.DirectionID = Headers.DirectionID) INNER JOIN SpeedImport ON Headers.RecordNo = SpeedImport.RecordNo
WHERE (((SpeedImport.RecordHour) Between "00" And "23"))
GROUP BY SpeedImport.RecordDate
ORDER BY SpeedImport.RecordDate
PIVOT Headers.SiteNo;
The code after transform is incorrect, I just want to know how I would go about doing it in SQL in access or possibly in VBA.
I want the query to output data like this . . .
ie. between 12:00 and 14:00
RecordDate 85th Percentile
24/06/2004 60.7
25/06/2004 55
26/06/2004 55.7
This is easily done in excel, but not so in access.
Any help would be great guys
Last edited: