|
|
Question : Averaging a Sum in Crystal Reports
|
|
I have been working on a Crystal Reports report that shows the sales for associates. It is one report with sales for two different years broken down by months. I add up all the sales from Jan to Dec of a particular year and add the year's sales allocation number to get a final total for the year. I got the final total for the year by doing a running total from Jan to Dec of the year. Then I sum the Running total and the Year's sales allocation to get a final total for the year. This formula works for both 2005 and 2006 years. The problem I'm having is trying to average the 05 and 06 totals. I can't seem to get the average of the two total numbers for both years because it's a formula.
Here's an example:
Sally Salesperson West Coast Territory Year 2005 Jan 1000 Feb 4000 Mar 3000 . . . . Dec 9000
Running Total from Jan to Dec //This formula is hidden in the report - This formula work for 2006 as well. 2005 Sales Allocation 12000 2005 Final Total 34000 //I create a formula that will use the Running Total and add the Sales Allocation number. Here is formula "@sum = {#RTotalFundSales}+{tblMonthly.Sales Alloc}"
Year 2006 Jan 1000 Feb 2000 Mar 3000 . . . . Dec 9000 Running Total from Jan to Dec // This formula is hidden in the report 2006 Sales Allocation 34000 //This number is different from the 05 Sales Allocation) 2006 Final Total 75600 //The formula created for the 2005 Final total works for this final total because of the grouping.
Two Year Average Final Totals for Sally Salesperson = In this example, the average of 05 Final Total (34000) and 06 Final Total (75600) is 207800. //I've tried to write a formula to average both the 05 and 06 Final totals but it seems that I can't average a formula. I can't hard code the numbers because the report can be generated by salesperson. So every salesperson will have a different outcome.
Any suggestions on how I can get the two Final totals to average would be greatly appreciated.
|
Answer : Averaging a Sum in Crystal Reports
|
|
How do you get that as the average?
Have you tried using the SUMMARY capability?
You might have to use a manual running total with variables.
In the report header Add a formula Name DeclVars Formula WhilePrintingRecords; Global NumberVar MyTotal := 0;
In the detail section Add a formula Name DeclVars Formula WhilePrintingRecords; Global NumberVar MyTotal; MyTotal : MyTotal + {SaleField};
In the footer where you want to calculate the average Add a formula Name DispAverage Formula WhilePrintingRecords; Global NumberVar MyTotal; MyTotal / 2 ' Use whatever formula for the average.
mlmcc
|
|
|
|