Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 662
  • Last Modified:

Average of running total in crystal report

Hi Experts

I have a windows application and a Crystal report on it. I use the running total to get a sum of money per group. And when I try to get the average of that running total it says: "This field cannot be summarized". Okthen I tried to do it manually: sum({@Consumption}) / {#Count} But then when I run the report it says: "Division by zero" Can you please help me on getting the average in a report?

Thanx in advance
0
Benvor
Asked:
Benvor
  • 4
  • 2
1 Solution
 
mlmccCommented:
A running total is calculated as the report is printed.  Summary functions are done much earlier in the report process.

Where did you put the Average formula?

What is #Count?

What is the formula for @Consumption?

mlmcc
0
 
BenvorAuthor Commented:
1) I put the Average Formula in a Group Footer

2) #count is a running total set to 'Count' instead of 'Sum' to get the total amount of items to divide by

3) @Consumption = ({FuelRecords.Kilometers} - {FuelRecords.PrevKM}) / {FuelRecords.Fuel}
0
 
mlmccCommented:
Do you have a group with no records?

You can eliminate the 0 divide error in this way

If {#Count} =  0 then
    0
else
    sum({@Consumption}) / {#Count}

mlmcc
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
BenvorAuthor Commented:
There isn't supposed to be a group with no records. But I tried your formula but I still get the error, Division by zero.
0
 
BenvorAuthor Commented:
Please anyone help me to get the average of a sum value please?
0
 
BenvorAuthor Commented:
Thanx mlmcc for all your help, When I actually ran the program for the first time the error was much more descriptive and I could get the problem. So for anyone who just switches between views on your crystal report and get errors that don't explain anything, just run the program then the error will give you an exact description
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now