Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Reports XI Post Reply Post New Topic
Author Message
pburdette
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 5
Quote pburdette Replybullet Topic: Crystal Reports XI
     Posted: 29 Apr 2010 at 3:41am
I need to take and average of the monthly group sum
 
I have made a group and took the sum per month.  Now I want to take the average of each month's sum.  Crystal reports will not allow me to do this. 
 
Does anyone know a solution.  I have read the user manuel but come up empty.  I can do it in excel but that would be painful.
 
Please respond soon.
Pat
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Apr 2010 at 3:58am

if this is more than 1 year of data try this:

create a formula field as text version of month year
totext(monthname(month({DATE}))) + totext(year({DATE}))
 
now use this for your average formula
SUM({field})/distinctcount({@month year formula})
 
 
IP IP Logged
pburdette
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 5
Quote pburdette Replybullet Posted: 29 Apr 2010 at 4:17am

Here is a sample of my data

 

Number         user                           minutes

                    month

123456         tom                         1234

                     month 2

                     tom                         6543

                    month3

                     tom                         4521

123456       tom                          xxxx

 

these total are monthly sums from my database.   Month, month 2, etc is a group.

What I want to is in my number group total ( is have xxxx to be the avg of my monthly sums. 

 

Hope this helps.  If I can give you a screen shot it might help illustrate.

 

Pat
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Apr 2010 at 4:45am
Do you mean that you already have the "123456" total for Tom as a field from your DB without having to do any calcs in crystal?
IP IP Logged
pburdette
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 5
Quote pburdette Replybullet Posted: 29 Apr 2010 at 4:49am

NO.  It is a calc in CR that I did for each month for each person.  I want to avg the monthly totals.

 
 
Pat
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Apr 2010 at 4:54am
you cannot summarize a summary (e.g. Average(sum)).
However the average can also be the sum of the records / the count of the months, correct?
 
SUM({field})/distinctcount({@month year formula})
could be altered to a group level
SUM({field},{group})/distinctcount({@month year formula},{group})
IP IP Logged
pburdette
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 5
Quote pburdette Replybullet Posted: 29 Apr 2010 at 4:58am
yes.  Now I need the correct syntax to put in the report in the group.  Do I need to make a special "@" group?
Pat
IP IP Logged
pburdette
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 5
Quote pburdette Replybullet Posted: 29 Apr 2010 at 5:16am
That worked perfectly.  Thanks!
Pat
IP IP Logged
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