Fsyeda,
This looks like a Running Total solution. There is a wizard within Crystal that is likely sufficient for something like this, though I have personally never used it and prefer to setup the RT's manually. I would suggest taking a look at the wizard first, and if that is unable to help you, please reference below.
If you are looking for another example, I had provided this similar solution to another TekTipper in June: thread767-1712972
For your application, you will need one "set" of three formula's for each of your columns (to allow the most flexibility). The "RESET" will go in the Employee Header, with the "ACCUMULATION"s in the Group Header for Year, and the "DISPLAY" will be in the Employee Footer (as I understand your report). The following also assumes your report will
always be presented as shown in the example (with the current year above the prior year - you will need to adjust the approach if Prior is always above Current).
Anywho, assuming all of the above, the solution would appear like follows: (there may be some fine tuning needed)
Formula Set #1 - SALES
{@RESET_SalesVarianceRT}
Code:
WhilePrintingRecords;
Shared NumberVar SalesVarianceRT:=0;
{@ACCUM_SalesVarianceRT}
Code:
Shared NumberVar SalesVarianceRT:=SalesVarianceRT - SUM({YourSalesField},{YourEmployeeIDGroupField)
{@DISPLAY_SalesVarianceRT}
Code:
WhilePrintingRecords;
Shared NumberVar SalesVarianceRT;
Formula Set #2 - MARGIN
{@RESET_MarginVarianceRT}
Code:
WhilePrintingRecords;
Shared NumberVar MarginVarianceRT:=0;
{@ACCUM_MarginVarianceRT}
Code:
Shared NumberVar MarginVarianceRT:=MarginVarianceRT - SUM({YourSalesField},{YourEmployeeIDGroupField)
{@DISPLAY_MarginVarianceRT}
Code:
WhilePrintingRecords;
Shared NumberVar MarginVarianceRT;
Hope this helps, or at least points in you in the right direction.
Cheers!
Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."