|
-
Feb 10th, 2006, 03:52 PM
#1
Thread Starter
Addicted Member
Cannot divide by zero problem...
Hi,
I have a report that is calculating the sum of a percent column.
I'm storing the count for different values and calculating a total for
that group. Then I use the total for that group to calculate the percent
total.
I'm using the code below:
Sum ({@valuect}, {Depname.depdes})/Sum ({@grouptotal}, {Depname.depdes})* 100
I keep receiving the cannot divide by zero error. I tried adding the
following code:
if Sum ({@valuect}, {Depname.depdes})<> 0 then Sum ({@valuect}, {Depname.depdes})/Sum ({@grouptotal}, {Depname.depdes})* 100
When I add the If statement, I have all zeros for the first and last percentage columns.
-
Feb 10th, 2006, 04:36 PM
#2
Re: Cannot divide by zero problem...
It's not Sum ({@valuect}, {Depname.depdes}) that's the problem... it's Sum ({@grouptotal}, {Depname.depdes}) .... you need to check to see if Sum ({@grouptotal}, {Depname.depdes}) is 0, and if it is, return 0, ELSE do the calculation.
=tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|