Solved

Average of running total in crystal report

Posted on 2009-07-09
6
651 Views
Last Modified: 2013-11-26
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
Comment
Question by:Benvor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 24811554
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
 

Author Comment

by:Benvor
ID: 24811586
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
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 24814791
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:Benvor
ID: 24820782
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
 

Author Comment

by:Benvor
ID: 24821180
Please anyone help me to get the average of a sum value please?
0
 

Author Comment

by:Benvor
ID: 24821394
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question