Skip to Content
avatar image
Former Member

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?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    May 20, 2015 at 07:45 AM

    Hi Joseph,

    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.

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I was sure that I had tried this already, Abhilash, but after you suggested this, I went and tried it again, and this time it worked! I think I had not chosen the 'Evaluate' setting correctly. Thank you VERY much.

  • avatar image
    Former Member
    May 20, 2015 at 06:32 AM

    Hi Joseph,

    please go thorugh the following article , it will help you in summing up values based on your requirements.

    http://stackoverflow.com/questions/1545883/conditional-group-sum-in-crystal-reports

    Regards

    Ganesh


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you, Ganesh, but unfortunately this winds up with the same problem. It's summing as if I were drawing from each line-item instead of each order. Even though there's only 1 order in the system, it's summing it up as if there were as many orders as it has line items.