How do I sum data in an outer group?
I'm using Crystal Reports 2008 to put together a report. I've got two views: One, a list of orders, the second, a list of line items.
The orders are grouped by location.
The line items are grouped by order.
Report Header - suppressed
Page Header - suppressed
Group Header #1 - Reports which location we're at. (new page before)
Group Header #2 - Reports which order we're looking at.
Details: Gives the line item information
- Has Line Item Price
Group Footer #2 - gives the order summary
- Subtotal: Running Total (Line Item Price) - reset after group 2.
- Fright (column from order view)
- Total (sums the above)
Group Footer #1 - gives the summary for that location
- Complete Subtotal: Running Total (Line Item Price) - reset after group 1
- Complete Freight: Sum (Freight)
- Grand Total (Sums the above)
The problem comes up with Complete Freight - everything else is working great. Complete Freight is not summing up the freight charges the way I want them to. It is summing the freight once per line item view, not once per order view.
For instance, that there are two orders in the report - each of them has three line items. The first order has Freight charge of $10. The second has a Freight charge of $15. The Complete Freight should be $25 - the sum of the two. Instead, I get a Complete Freight of $75 (3 x $10 + 3 x $15).
Why is this happening and how can I fix it?
Abhilash Kumar replied
Here's what you need to do:
1) Create a new Running Total for 'Complete Freight'
2) Choose 'Freight' as the Field to Summarize > Choose 'Sum' as the summary function
3) Under 'Evaluate' choose 'On Change Of' and select the Order Group
4) Reset should be set to Never.