Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating first and last row time in a day for total time

Status
Not open for further replies.

TerriO

Technical User
Jan 9, 2002
84
US
Crystal V8

Table
Name Activity Date/Time
Ben update 2/7/2005 5:48pm
Ben Change Name 2/7/2005 5:55pm
Ben update 2/7/2005 6:02 pm
Ben update 2/8/2005 12:04 pm
Ben pct status 2/8/2005 12:10 pm

I need to be able to calculate the first field of data and last field of data showing total time for the day.

Ben 2/7/2005 2/8/2005
14 minutes 6 minutes

What formula do I use to get 2/7/2005 times 5:48 and 6:02 to compute the difference

Terri
 
Group by the name, and then by the datetime field, only group for each day.

Create formulas to get the minimum and maximum for the datetime field within each date:

minimum({table.datetime},{table.datetime})

maximum({table.datetime},{table.datetime})

Now you can simply use the datediff function to get the number of minutes in the group 2 footer (date), as in:

datediff("m",minimum({table.datetime},{table.datetime})maximum({table.datetime},{table.datetime}))

And display the results at each date group break, so it would look like:

Ben
2/7/2005
Ben update 2/7/2005 5:48pm
Ben Change Name 2/7/2005 5:55pm
Ben update 2/7/2005 6:02 pm
14 minutes

If you really need the format you speak of with horizontal alignment, then I would suggest storing them to arrays or variables and displaying in the name group footer.

-k

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top