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!

crystal reports calculating the average of a calculated field 1

Status
Not open for further replies.

ChinnyChin

Technical User
Jul 31, 2017
3
0
0
US
I have a Crystal report that I am calculating the dd:hh:mm:ss between order dates to determine turnaround time. My formula name for this is " Individual TAT" as it is the individual turnaround time for each order.

I have a group on company name, and I am trying to do a summary to identify the AVERAGE turnaround for each company group. However, it does not appear I can do a summary on a calculated field. I want to put the average TAT for each company in the group header. See attached screenshot.

Thanks in advance for your assistance.
 
 http://files.engineering.com/getfile.aspx?folder=490e656e-6b8e-44ef-a93d-70a6ae4be965&file=Crystal_Screenshot.docx
You probably will have to create a formula to 'manually' do the average. Crystal reports will not let you do a summary on a summary normally.
 
You should create a formula that calculates the difference in seconds for each row without converting it to string, e.g.,

//{@diff}:
Datediff("s",{table.receiveddate},{table.approveddate})

Then you can use a separate calculation:
Average({@diff},{table.company})

...in the conversion formula (whatever you used for the row display).

-LB
 
Is this what you were suggesting? I am getting an error "The ) is missing" on the (dur section of the days row.

whileprintingrecords;
Average({@Individual TAT},{'request_log__4__'.Agency});
numbervar days;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar ddhhmmss;
days:= Truncate(Truncate(Truncate(dur/60)/60)/24);
hrs := Remainder(Truncate(Truncate(dur/60)/60),24);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

ddhhmmss := totext(days,0,"") + ":" + totext(hrs,"00") + ":" + totext(min,"00") + ":" + totext(sec,"00");

ddhhmmss
 
You left out the variable name assignment in front of the line containing the average:

Numbervar dur := average( etc.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top