Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 26 Feb 2009 at 2:24pm
I think if your groups are set right you can use a running total and set it to sum on change of group and reset on the next group higher and it will only sum the field once (kind of like a distinct sum).
Joined: 11 Jul 2007
Location: United States
Online Status: Offline
Posts: 23
Posted: 26 Feb 2009 at 2:52pm
Assuming I'm doing it correctly, it doesn't work. (Create a Running Total field in Field Explorer Window - Field to Summarize is Base Amount - Type of Summary is SUM - Evaluate "On Change of Group" - Reset "On Change of Group". I put the Running Total field in Group 1 - Contract.
As you can see from the tables above the Base Amount is repeated in each invoice. A running sum at the contract level sums the Base Amount from each invoice. For Contract 12345 in the above example that totals 790,000 when it should be 170,000.
I also tried "Averaging" the Base Amount in Group 2 (Machine) and then doing the Running Total (SUM) on the calculated field but it wouldn't let me select the calculated field.
Is there a way to use a "Conditional" Running Total wherein I could use the "Averaged Base Amount" from Group 2 (Machine)? I know you can use a formula such as {FieldName} >1000 but not sure how to include a "calculated" field.
I also tried calculating the "Average" Base Amount and then putting it into a formula to see if I could SUM the averaged amounts (and then put that field into Group 1 (Contract) but Crystal Reports won't let me calculate the "Sum of Averages". I believe Crystal does not allow you to combine Summary functions.
Following was what I tried in the formula:
SUM Average ({Table1.BaseAmount}, {Table1.Machine})
Also tried
SUM (Average ({Table1.BaseAmount}, {Table1.Machine}))
I appreciate any and all ideas to help me solve this problem.
Joined: 16 Feb 2009
Location: United States
Online Status: Offline
Posts: 6
Posted: 09 Mar 2009 at 11:13am
Originally posted by Krazy Kasper
Assuming I'm doing it correctly, it doesn't work. (Create a Running Total field in Field Explorer Window - Field to Summarize is Base Amount - Type of Summary is SUM - Evaluate "On Change of Group" - Reset "On Change of Group". I put the Running Total field in Group 1 - Contract.
If I'm understanding you correctly, I'd triple check that you're evaluating the running total "On Change of Group" for the Machine group. The numbers you're giving look to me like they're evaluating for each record. If it's set to evaluate on change of machine group, the only other thing I can think of is to set a global variable to act as a running total. You can then specify the
Global NumberVar RunTotal := 0;
In the Contract group header to reset the variable, then
WhilePrintingRecords;
If RecordNumber = 1 or ({Table1.Machine} <> Previous({Table1.Machine}))
Then NumberVar RunTotal := {Table1.BaseAmount}
Else RunTotal := RunTotal;
RunTotal
In the detail section and contract group footer.
Hope this helps, or at least points you in the right direction.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum