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
BenvorAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mlmccConnect With a Mentor Commented:
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
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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
All Courses

From novice to tech pro — start learning today.