Print Page | Close Window

Problem with Sum

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8052
Printed Date: 02 May 2024 at 2:56pm


Topic: Problem with Sum
Posted By: pucrilas
Subject: Problem with Sum
Date Posted: 17 Oct 2009 at 8:53am
Hello! I'm new to this forum and although I have a couple of years of experience with Crystal I've always used it for simple reports.

I am having a problem with a Formula I created.

Global NumberVar TotalAmount;
TotalAmount := {Table1.TotalEarned} / {Table.DividebyValue};

The problem I am having is that Table1 might have more than one row for each Table1.User field. For example

Table1.User Table1.TotalEarned
2001              100
2004              200
2001              350
2003              450

The problem is that the formula only takes into consideration the firt 100 instead of the sum of 450 which is the total for both entries for User 2001.

How can I fix it so it sums all the values that the table could have for each user??



Replies:
Posted By: lockwelle
Date Posted: 19 Oct 2009 at 7:03am

since it is grouped on table1.user,

TotalAmount := sum({Table1.TotalEarned}, {table1.User}) / {Table.DividebyValue};



Print Page | Close Window