cancel
Showing results for 
Search instead for 
Did you mean: 

Sum and Average Group Wage instead of Details Wage

Former Member
0 Kudos

I have a subreport where I have included all of our employment records and grouped it by employee ID. In the Group Footer, to show the latest employment record I used the Max(Start Date) and I have also placed the Hourly Wage field here which shows the appropriate Wage for the Max Date. But I can't seem to use the Sum or Average Summary because it Sums and Averages All Wages in the Details report vs. only the latest record.

So, how do I Sum/Average the wages for only the last employment record Or how do I create the report to show only the Last Employment Record?

I'm using Crystal XI. Any help will be greatly appreciated.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Place the fields in group header instead of placing in details section using maximum() function. Now got to report>record sort expert>add start date field-->select descending order.

Now the report shows latest date entries for each group.

If you want to calcualte the sum then use mannual running totals like

create a formula like

@sum:

whileprintingrecords;
numbervar i;
i:=i+{field}

Now place this in group header and supress

create another formula like

@Total:

whileprintingrecords;
numbervar i;

place this in report footer which gives grand total.

Regards,

Raghavendra

Former Member
0 Kudos

That worked. Thank you.

I think I understand what the formulas are doing but was trying to understand how the sorting played a role. So by sorting it, this places the latest record first Z-->A which the Average and Sum look at? Is that correct?

Thanks again.

Former Member
0 Kudos

When you place any field in group footer it shows only first value of the field in header. So by sorting it in descending order it gives first value that is Z.

Regards,

Raghavendra

Answers (0)