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

calculation of SUM

Status
Not open for further replies.

rajiabraham

Programmer
Nov 28, 2000
3
US
i am writing formula to calculate Sum based on condition. For
example
if {table.field} = 8 then
formula = sum({table.field})
end if
but it is calculating Sum for all values of the field irrespective of
condition.(With Basic syntax)
 
This expression in Crystal:

sum({table.field})

refers to the reports grand total of that field, so you are saying, on records with an 8, print the grand total.

To do a conditional total you could use a conditional formula field:

if {testfield} = 8
then {fieldtosum}
else 0

This creates a column of values that only include the values from the selected records. Now Insert a subtotal or grand total of this formula.

If you want to do running totals of a column, read the FAQ on running totals. 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