PDA

Click to See Complete Forum and Search --> : [RESOLVED] Divid By Zero Problem


ZoeWashburn
Feb 13th, 2008, 06:06 PM
Hey guys,

I'm working on a report in Crystal 10. I'm trying to calculate a percent based on two fields that are sums of other fields. Here's the basic gist of it:

Code for formula field Ratio:


WhilePrintingRecords;
(SUM({fieldx}, {groupa}, "daily")/SUM({fieldy}, {groupa}, "daily)) * 100


I've tried EvaulateAfter(x), WhilePrintingRecords, assigning the sum fields to variables, you name it. Every time, it gives me a "divide by zero" error. But when I take the Ratio field out, the values for the sum fields are anything but zero! The only thing I can figure is that Crystal is trying to calculate the ratio before the sums are calculated, but I can't find anything that will force that to change.

Any ideas?

Thanks,
Zoe

VBFnewcomer
Feb 14th, 2008, 02:16 AM
can't find anything that will force that to change.
I dont know much about ratios but using paranthesis () at appropriate places should help
:afrog: :wave:

ZoeWashburn
Feb 15th, 2008, 12:23 PM
I got it figured out. Turns out I had some data segments where the field values actually were zero, and I could easily modify my select statements to weed those out. All good now!