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

Subtotaling a formula with an embedded Sum function

Status
Not open for further replies.

awhitney

MIS
Jun 14, 1999
6
US
Help!!!!

I am working on a timesheet report that totals the number of hours per day based on various time entry activities. I need to calculate comp time hours based on if the sum of the daily hours total more than 8.

My formula is as follows:
if Sum ({@CheckRegHours}, {ReportBiWeekTimeSheets.te_time_entry_day}, "daily") > 8 then
Sum ({@CheckRegHours}, {ReportBiWeekTimeSheets.te_time_entry_day}, "daily") - 8;

Then, I need to summarize all of the excessive hours and the end of report. The problem is that I am unable create a subtotal for the above formula. The option is greyed out.

I have 3 different group: the person, the pay period, and the day. Is there another way to calculate the excessive hours and be able to total.

All suggestions are welcomed. Thanks.
 
Crosstabs should give you totals independent of the main report. This depends a bit on your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I am using version 8.5 and one of the sub reports is a crosstab. Unfortunately, the users want these totals outside of the crosstab.
 
I think you can have as many crosstabs as you like. The alternative is a 'Mock-Crosstab', more flexible but a lot more work.

A 'Mock Crosstab' is something that looks like a Crosstab, but in fact you define each column yourself, normally as a running total. This would need to go in the report footer, because running totals count as the reports 'run' and they will not be complete until then.

Crystal should have included an example along with the Crosstabs. You can save a little time by doing a paste to a dummy report, changing the name and then pasting back.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You could use variables to summarize your formula. You would use a separate variable for each level you want to summarize at, and you need a separate reset formula for each. Using one group as an example, e.g,person, you would create these formulas:

//{@reset} to be placed in the group header:
whileprintingrecords;
numbervar sumhrs;
if not inrepeatedgroupheader then
sumhrs := 0;

//{@accum} to be placed in the section containing your formula:
whileprintingrecords;
numbervar sumhrs := sumhrs + {@yourformula};

//{@display} to be placed in the group footer:
whileprintingrecords;
numbervar sumhrs;

So you need one reset formula for each variable. You can put all the variables in the same accum formula, and then you need separate display formulas for each variable.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top