[RESOLVED] Divid By Zero Problem
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:
Code:
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
Re: Divid By Zero Problem
Quote:
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:
Re: Divid By Zero Problem
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!