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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Condition fields in a Sum Function

Status
Not open for further replies.

Doogie7

Programmer
Dec 15, 2000
3
CA
Hi
I am using Crystal Reports Version 8 and attempting to perform a summation on a number of values that I have in my crystal report. The report is based on a SQL query which brings in a large amount of data. Rather than perform the summations on the various groups within the SQL query, I would like to use a SUM function on the report to add up various scores. The problem is that my report has many groups by which to group the information - ie By Province, By Store Type, By Store group, by Store Number.

I need the report formula to summarize all values by store group, but store number. But when I insert a formula into the report using the SUM function, I can only group it by one field (seemingly there are three sum formulae - SUM(fld), SUM(fld,condfld) and SUM(fld,condfld,cond). When I try to use the SUM(fld,condfld) function I cannot use multiple conditional fields as the second parameter.

The formulas do not appear to adhere to my groupings either, since if I just sum scores and place this within the last group footer, the formula returns a sum of ALL of the scores, ungrouped.

My question is - is there a way to group fields within a SUM formula (or any other type of formula, as I also need the avg score) or link the SUM formula to my groupings within the report?
Or better still, is there a way to use multiple field by which to base the sum on in the condFld parameter. I am hoping that this is just a syntax issue and there's some way to group conditional fields into one large condfld.

Thanks
 
Crystal used unfortunate terminology with the summary functions. I recommend that you read the help, but here is the short answer:

Sum(Fld) = Grand total of that field

Sum (Fld, conFld) = Subtotal of the field by a group 'condition'. The 'conFld' means a group field and must be one the existing groups in your report.

Sum (Fld, conFld, Cond) = Subtotal of special date groups. The Cond is something like "Weekly" or "Monthly" and only works with date groupings.


Sounds like you simply want summaries at several existing group levels. You don't need formulas to do this. Simply highlight a field and select "Insert - Summary". Select the operation and the group. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top