Smart questions
Smart people
 Find A ForumFind An Expert
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Remember Me

Are you a
Computer / IT professional?
Join Tek-Tips now!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Just copy and paste the

#### Feedback

"...If I'd only had resource like eng-tips when I was just getting started! I might have dazzled them with my brilliance instead of my BS..."

#### Geography

Where in the world do Tek-Tips members come from?

# Time Difference in a Group

 Forum Search FAQs Links Jobs Whitepapers MVPs
 tkschief (MIS) 22 May 12 9:15
 I am using Crystal Reports 11 and have a report that is grouped by case number. In each group, there are 4 events. I'm not sure how to calculate the time difference in minutes between the Locate Date and each of the 3 deadline events. I attempted a formula but the time difference is always 0 so obviously I am doing something wrong. CASE NUMBER DATETIME EVENT TIME DIFFCase Number 05/18/12 12:19PM Locate DateCase Number 05/18/12 12:42PM Deadline Service w/in 90 Days 23 minCase Number 05/18/12 12:44PM Deadline Order w/in 6 Months 25 minCase Number 05/18/12 12:47PM Deadline Order w/in 12 Months 28 min05/18/12 12:47PM is a datetime fieldGoal: 1st deadline datetime minus locate datetime = time difference in minutes 2nd deadline datetime minus locate datetime = time difference in minutes 3rd deadline datetime minus locate datetime = time difference in minutesI thought I would need to create a variable for the Locate Date in order to calculate the time difference between the Locate Date and each of the Deadline dates.Attempted Formula:DateDiff('m',{Command.Create Date},{@LocateDateVar})Attempted Variable:If {Command.EVENT_TYPE_ID}=1000223 then {Command.Create Date} Any help would be appreciated. Thanks!
 pmsawyer (Programmer) 22 May 12 10:08
 In your DATEDIFF funtion you are using the wrong interval. 'm' is for month which will give a 0 for the sample you provided. The correct interval is 'n' for minute. I would use a global variable for the locate date then reference it from the other three records resetting for each group.
 lbass (TechnicalUser) 26 May 12 12:21
 You could use this:datediff("n", maximum({@LocateDateVar},{table.casenumber}),{Command.Create Date})-LB

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!