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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula

Status
Not open for further replies.

jalenben1

Programmer
Jul 22, 2008
154
0
0
US
In Crystal Report I have 3 times that I would like to get the average of:

The field name is MTTR Restoral Time and the 3 times are as follows:

4:00
6:98
4:87

How to get the average of the times?
 
are these hours and minutes, because the :98, and the :87, have me confused..
 
Yes..I am sorry..the correct times are


4:00
6:58
4:87

and they are in the format - dd hh mm (Days, Hours: Minutes)
 
The 4:87 still looks strange.

To get an average convert to a base unit number. I would use Hour({Field}) * 60 + Minute({Field})

Then create an average of that number and convert back:
myHour := Fix(Sum((FormulaAbove}) / 60);
myMin := Remainder(Sum({FormuaAbove}),60);
ToText(MyHour,0) + ":" + ToText(MyMin,"00")

Editor and Publisher of Crystal Clear
 
I am a little confused...do I use this formula:

Hour({Huawei_Dashboard.MTTR Restoral Time}) * 60 + Minute({Huawei_Dashboard.MTTR Restoral Time})

myHour := Fix(Sum({Huawei_Dashboard.MTTR Restoral Time}) * 60 + Minute({Huawei_Dashboard.MTTR Restoral Time}) / 60);myMin := Remainder(Sum({Huawei_Dashboard.MTTR Restoral Time}) * 60 + Minute({Huawei_Dashboard.MTTR Restoral Time}),60);ToText(MyHour,0) + ":" + ToText(MyMin,"00")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top