Need Help Calculating Percentage of Records in Certain Amount of Time

  • Thread starter Thread starter Tbird2340
  • Start date Start date
T

Tbird2340

I have two date fields "DateSubmitted" (with a default value of NOW()) and
"CompletedDate" (which is a user submitted long date value). I then have a
query with a field that calculates the time it took to complete the request
which is as follows:

TimeTook: Format(Int([DateSubmitted]-[CompletedDate]),"0"" day(s)""") &
Format(Now()-[DateSubmitted],""", ""h"" hour(s), ""n"" minute(s), ""s""
seconds""")

What I want to do is calculate as a percentage the number of requests
completed within 1 hour, 4 hours, 1 day, and more then 1 day..

IE. I want the results to be similar to this:

65% requests completed within 1 hour.
20% requests completed within 4 hour.
10% requests completed within 1 day.
5% requests completed more then 1 day.

I have no idea of where to even start...

P.S. The results will be displayed on an ASP page..

Thanks for any help!
 
Well, if oyu are going to do this in an ASP page I'd suggest creat a
totalrequests variable. Calculate that (record count, count query,
however you fancy).
Make a query for each time period (1 hour, 4 hour, 1 day, more than 1
day)

What migh be better is to use the DateDiff function.
TimeDiff: DateDiff("h", [DateSubmitted], [CompletedDate])

This will result in a time difference in hours.

Then you need 4 queries where the criteria will be
TimeDiff < 1
TimeDiff >= 1 and TimeDiff < 4
TimeDiff >= 4 and TimeDiff < 24
TimeDiff >= 24

Use < or <=, > or >= where needed.

For each fo those queried either use a Count or a record count and
compare to your totalresults
 
Wow! Thanks for the reply... Any chance you can help me with the code? (if
it's not too much trouble).
 
Eeeeks, ASP classic code or ASP.NET? I know ASP.NET without looking at
resources. I;d have to look up info for ASP classic.

Your best bet from this point is to talk to an ASP newsgroup or
htttp://www.asp.net (forum handles both ASP.NET and ASP classic).
 
Well I'm just using Dreamweaver MX 2004 VB asp...

I thought a lot of that would be access code in queries but it doesn't sound
like it from your respsonse...

Thanks for the help..
 
You will use queries to get the totals you need, but you will have to
figure out the percentages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top