Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUM function and group on multiple fields

Status
Not open for further replies.

Kocky

Programmer
Oct 23, 2002
357
0
0
NL
Hi all,

I am using Crystal Reports XI and want to do the following:

I need to make a sum of a quantity field but the group by should be done on two columns.

The primary key of the table looks like this:

COLLECTION_ORDER -> OrderNumber
COLLECTION_ORDER -> OrderLineNumber

I want to sum the field COLLECTION_ORDER -> Quantity and have a group by on the primary key.

So the sum should look like this:

Sum ({COLLECTION_ORDER.QUANTITY}, [{COLLECTION_ORDER.ORDERNUMBER}{COLLECTION_ORDER.ORDERLINENUMBER}])

But this is not supported.
Is there a way to do a group by on more than one column ?
 
Just want to make sure I understand the question. You have multiple entries per line number. But you do not want to see the total line number. You just want to see the total for the order? You could always group by order number and line number,, calculate the amounts, and just supress the secondary "break",, and not show it, or print it. If you can show an example, of the data, and how you want it totaled it may be helpful.
 
You are posting in the wrong forum. Your post should be in forum149 or forum767.

If you insert the two groups, you can simply place your quantity field in the detail section->Right click->insert a sum first on one group and then on the other.

Groups are nested in Crystal, so the summaries for Group#2 would fall within Group #1. If you want to write the formula for the inner group summary, you would just use group #2 condition, not both.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top