Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to Average a date/time field Post Reply Post New Topic
Author Message
JGARDNER-AIT
Newbie
Newbie
Avatar

Joined: 27 Jan 2010
Location: United States
Online Status: Offline
Posts: 11
Quote JGARDNER-AIT Replybullet Topic: How to Average a date/time field
     Posted: 20 May 2011 at 5:42am
Hello - typically this is very easy to do. But I am unable to average a date/time field. Do I need to convert this to another data type?
 
Data itself is starting clock time for a user. I'm looking for a average start time.
 
Thanks - Josh
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 20 May 2011 at 10:48am
I know in the formula field you can use" Average()" but you may have to convert the field into a string then average it and convert it back into time.
IP IP Logged
JGARDNER-AIT
Newbie
Newbie
Avatar

Joined: 27 Jan 2010
Location: United States
Online Status: Offline
Posts: 11
Quote JGARDNER-AIT Replybullet Posted: 20 May 2011 at 10:58am
whats the proper way to convert to a date/time field into a string?
 
Originally posted by CircleD

I know in the formula field you can use" Average()" but you may have to convert the field into a string then average it and convert it back into time.
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 20 May 2011 at 1:09pm
Is it an actual Date/Time field or is it a number string?

Date/Time you can use toNumber to make it a number string then average it and use toDateTime to convert it back to Date/Time.If it's already a number string then average it and skip the to number part.Somebody better then me will have to give you the actual formulas but this should point you in the right direction.
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 20 May 2011 at 2:16pm
Before going through all that though have you tried usung a summary on that field and choosing "average" in the drop down box?
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum