Best way – use the three formula trick for Crystal. You have the control instead of wondering what Crystal is doing with Sums (which can be wrong depending on your Grouping) and I have hit or miss success with Running Totals so I never use them anymore.
At the Group Header
WhilePrintingRecords;
Shared NumberVar GroupSum;
GroupSum :=0;
- This declares and set the variable “GroupSum†to 0
At the place you what to do the calculation
WhilePrintingRecords;
Shared NumberVar GroupSum;
GroupSum := GroupSum + (Field or Expression you want to add)
OR
GroupSum := If Condition A then GroupSum + (Field or Expression you want to add) Else GroupSum
- This will control exactly when you want to add
- The If can be expanded for more If/Else conditions
In the Group Footer where you want to display it
WhilePrintingRecords;
Shared NumberVar GroupSum;
Scott
From: vantage@yahoogroups.com
[mailto:vantage@yahoogroups.com] On Behalf Of cathy@...
Sent: Monday, September 09, 2013 5:45 PM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: Crystal Report Formula Question
There are many different ways to do this -
One way is to create a formula for plant A and B in the detail section of the report (which would be suppressed)
I don't know what tables you are using but, If Plant = A then OnHandQty Else 0
If Plant = B then OhHandQty Else 0
Then you can add a summary for Plant A and B by Part Number -
--- In vantage@yahoogroups.com, <clederer@...> wrote:
In my Crystal Report I have 2 groups Plant A & Plant B). I'm trying to create a formula to summarize the data in the group fields:
part #123 Quantity Cost
Plant A 5 50
Plant B 1 10
part #123 Quantity Cost
Plant A 1 10
Plant B 0 0
part #123 Quantity Cost
Plant A 4 40
Plant B 2 20
NEED FORMULA FOR:
Quantity Cost
Plant A 10 100
Plant B 3 30