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

Help Needed with Group Summary Calculations

Status
Not open for further replies.

proflola

IS-IT--Management
Jul 29, 2000
62
US
Hi All,

I can figure an Average Duration in the Group Heading that gives me an average in numbers for each group (ie 133.00). I need to convert the numbers to hours and minutes which I have a formula for. The problem I'm having is that if I create a formula that does the conversion, it shows me the total average of all groups instead of the average duration in hours and minutes for each group. It would seem that you are limited to using a Summary field to calculate the group values.

Does anyone out there have any ideas or experience with this?

Thanks a bunch!

Sandy

 
It depends on your version of Crystal. In Crystal 10, right-click on a field and choose Insert to get a choice of Running Total or Summary.

Choosing summary, you should get a choice of the type of summary and its level. It may well default to the whole report, but you can set it to group level.

You may not need them for this problem, but do also take a look at Running totals, a useful alternative to summaries. They allow you to do clever things with grouping and formulas. They also accumulate for each line, hence the name. The disadvantage is that they are working out at the same time as the Crystal report formats the line. You cannot test for their values until after the details have been printed. You can show them in the group footer but not the group header, where they will be zero if you are resetting them for each group.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You could probably just right click on the field in the detail section and insert a summary at the group level. If you are doing some sort of calculation and need to write the summary, then it would look like this--with a group condition as the second argument:

sum({table.amt},{table.groupfield})

-LB
 
I may have not stated my problem very well. Let me try again.

I have no problem with the summary field which is "duration". Duration is a number field. My problem is that I need to take the result of the summary calculation that is calculating the average of each group and convert it to hours:minutes to display in each group's header.

The formula that I use for the duration conversion in the detail section is @hour and it converts the duration to a string that displays hours and minutes, so I can't calculate on it.

I hope that makes it clearer. Thanks for your help.

Sandy
 
You should perform the group calculation using the duration field, not the string that you are displaying in the detail section. If the result is in seconds, then average the seconds at the group level by right clicking on the field in the detail section and inserting a summary at the group level. If you then want to convert it to a string, use SynapseVampire's FAQ767-3543, and use:

average({table.duration},{table.groupfield})

...for the numbervar dur.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top