Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Average of a summarized formula field Post Reply Post New Topic
Author Message
bash
Newbie
Newbie


Joined: 30 Jan 2013
Online Status: Offline
Posts: 12
Quote bash Replybullet Topic: Average of a summarized formula field
    Posted: 06 May 2013 at 10:21am
Hi,
I would like to know how to get the average of a summarized field. For example. I have a count field of "total_Records" which is string. I would like to get the average of this amount based on business days.
 
I feel it is not a simple average function as the business days condition involved. I Appreciate any helpful hand to sort out this.
 
Thanks to all.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 06 May 2013 at 11:02am
well, if it is not a simple average, I would create my own running total using variables, though you might be able to accomplish this using Running Totals...but they are DBlanks forte.

for variables, you typically have 3 sets of formulas:
initialize/reset, usually in a group header:
shared numbervar x:=0;
"" // this will hide the 0 zero on the report

a summary value, usually in a group footer;
shared numbervar x;
x

so far, pretty easy...now the hardest one, which might be simple
in the detail section, the accumulator
shared numbervar x;
if {table.field} then
x := x +1;
"" //again will hide the running value.

now the question is what to put in the 'if' statement...
I would try the DayOfWeek() function and do something like this:
if DayOfWeek({table.field}) > 1 and DayOfWeek({table.field}) < 7 then
x := x + 1;
""

this should you a count of weekdays, that you can then use to figure out your average.

HTH
IP IP Logged
bash
Newbie
Newbie


Joined: 30 Jan 2013
Online Status: Offline
Posts: 12
Quote bash Replybullet Posted: 06 May 2013 at 4:51pm
Thanks a lot for your input. I will try this and update you.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.