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

Inserting a summary on a group based on a formula 1

Status
Not open for further replies.

ITCPhil

Technical User
Jun 30, 2005
181
CA
I am using Crystal Report 8.5 with Symposium and trying to make an average for the month.

I am running into problems because I need to make this average using a group that contains results from a formula.

This is what I need to make my total avarege from. I've a group showing 20 business days which finds its results with

Sum ({CallsAnsweredDelay},{Timestamp}, "daily") /
Sum ({CallsAnswered}, {Timestamp}, "daily")

That part works just fine, I see my results for each day and they are accurate. Now, what I need to do is find out how to add those to give me the sum of the results to divide by 20 and make an average for the 20 business days but I cannot figure out how to do so.

I've run into this problem before, I cannot figure out how to make the sum of a group when its results are based on a formula, could someone give me direction?

Thanks in advance,
Phil
 
You need to use variables. Create three formulas:

//{@reset} to be placed in the outer group header (month?):
whileprintingrecords;
numbervar sumave := 0;

//{@accum} to be placed in the gtimestamp group header/footer :
whileprintingrecords;
numbervar sumave := sumave + Sum ({CallsAnsweredDelay},{Timestamp}, "daily") / Sum ({CallsAnswered}, {Timestamp}, "daily");

//{@displave} to be placed in the outer group (month?) footer:
whileprintingrecords;
numbervar sumave;
sumave/20 //substitute your calculation that results in 20 here.

-LB
 
Thanks Lbass for the answer, but it is working oddly. It makes an addition of my results in 2s instead of a total.

It basically goes Entry+Previous Entry to give a result. What happens is that at the end instead of giving me a total for the 20 entries, it gives it for the last 2.

This might be because you mention to place displave in thte outer group footer, but the report has no outer group. It only contains 1 group which groups by timestamp to show 1 day.

I am going to fiddle with it some more.
 
Then you don't need the reset formula, and the display formula belongs in the report footer.

-LB
 
Ok... I moved reset to my report header, but it still works funny. Here are the results side by side

Sum (my results) What the 3 formulas give :
18 18
10 47
10 67
10 87
10 107
16 132
14 162
47 224
10 281
11 301
11 323
14 348
10 372
10 392
10 413
30 453
9 493
10 512
10 532
10 553
 
Oops, posted as you did. Ok, I removed reset.

The number seem to work, but don't quite get there, it gives me a 28 when I should be getting 14. The result should be 280 and not 553 (I am removing decimals so it changes them a bit)
 
I got it working (I wish you could update your posts here) , I moved accum down to the report footer and it worked.

You are a real asset to this community Lbass, thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top