I would like to get results of the sum total of a certain field. I tried to use the sum function but it returns an error. Here it is:
Sum ({Ward.Ward})= "10"
any help greatly appreciated. need some nice examples Jimmy
MCSE, MCSA
if {Ward.Ward}= "10"
then {Numeric.field}
else 0
and then sum this formula. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
if {Ward.Ward}= "10"
then {Numeric.field}
else 0
and then sum this formula.
NOW how would the sum formula look like??
sum{Numeric.field}???
thanks, much appreciated Jimmy
MCSE, MCSA
You put the formula on the report.
Then you right-click on the formula and select:
Insert - Grand total
or
Insert - Subtotal
I am assuming that you are summing another numeric field for all recrods with a Ward of 10. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
the situation i am in is that i need to know the total number of wards that = 10 in the database for a particular month. so it's almost counting the number of wards that equal 10.
count{table.ward}
sorry for being confusing
Jimmy
MCSE, MCSA
and then sum the formula. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
Did you test that? Because I don't think that's going to come up with the goods here. You can't quantify a condition like that at a record level in the group header. You either do it the way Ken suggested, use a conditional running total, or use a variable to accumulate the count.
Yeah, it works fine. Because I hand over a load of reports to our support people thay like as few calculations as possible, so I've used this as a replacement to bring down the number of calcs from 2 to 1. Have a go at recreating the formula, I think you'll be suprised.
I've just tested the scenario you highlighted, and yes it gave me 2 not 4. The If statement stops it counting all records and it only counts where there is an instance of "10".
Looks like I've got to swallow a bit of pride here. It must be a pretty unstable way of doing it, because on the first test it worked fine, on subsequent tests it sometimes works, and sometimes doesn't. Sorry for my misleading comments.
You just had me curious because in theory, that IF shouldn't be possible, being as the group header only gets processed once, while the details for the same group may get processed 100s of times.
Anyway, have a good weekend - and see if you can grab those reports back before your support guys notice.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.