Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calculating time in an Access report

Posted on 2008-10-23
3
Medium Priority
?
244 Views
Last Modified: 2013-11-28
I have a table in my database that I wish to report on.  The data is organized as follows:

EventDate - DATE field
EventResult - TEXT field

There are 8 possible results, and the table looks something like this....

EventDate              Result
10/23/08 12:01        RED
10/23/08 12:02        BLU
10/23/08 12:02        RED
10/23/08 12:03        RED
10/23/08 12:04        GRN
10/23/08 12:05        RED
10/23/08 12:06        YEL
10/23/08 12:08        BLU
10/23/08 12:09        GRN
10/24/08 12:01        RED
10/24/08 12:02        RED
10/24/08 12:03        BLU
10/24/08 12:03        RED
10/24/08 12:07        YEL
10/24/08 12:08        RED

What I want to do is sub-total (count) the records and also determine the amount of time passed.  

EX:

10/23/08
RED-4
BLU-2
YEL-1
GRN-1
TOTAL-8
8 minutes
AVG 1 per minute

10/24/08
RED-4
BLU-1
YEL-1
GRN-0
TOTAL-6
7 minutes
AVG .85 per minute

I have worked out most of the problem with counting the 'subtotals' in the report by using a DCOUNT funtion in the group footer (thanks to help in another post!) but I have no idea how to attack the calculation of time passed from the first event to the last event for each day.  It's simple math ...  DATE2-DATE1=TIME ELAPSED, but how to I capture what the value for the first event of each day, the last event of each day, and calculate the difference between them by group?


0
Comment
Question by:callstate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:armynt4
ID: 22789979
Try using the min and max aggregate function in your report's query.

so max(Time1)-min(Time2)=time elapsed

I'll try it as well to see what i get.
0
 
LVL 6

Expert Comment

by:carazuul
ID: 22789997
Hi callstate,
DMAX - DMIN over the same criteria should work.
Regards,
carazuul
0
 
LVL 2

Accepted Solution

by:
armynt4 earned 2000 total points
ID: 22790543
So on the report you may need to play with the Result field sum calculation.  
But if you list all the time values in the detail of the report you can add a field in the date's group footer with a value like......


DateDiff('n',Min([Time]),Max([Time]))


[Time] being the name of the time value field in your table/query
Creating this Time field by .... Time: Format([EventDate],'hh:mm')

Should work.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question