Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Division by Zero Error Post Reply Post New Topic
Author Message
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Topic: Division by Zero Error
     Posted: 17 Oct 2012 at 9:33am

Hi,

I am using Crystal 2008. I am getting the Division by Zero error message, which points to my following formula:

If {@fSUMVaccine-Participation}/DistinctCount ({EMPLOYEE.FLDID2}, {EMPLOYEE.FLDLOC})*100 = 0 then 0 else {@fSUMVaccine-Participation}/DistinctCount ({EMPLOYEE.FLDID2}, {EMPLOYEE.FLDLOC})*100

What do I need to change in this formula to get it to work? Thanks!
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
martbar
Newbie
Newbie


Joined: 04 Apr 2012
Location: United States
Online Status: Offline
Posts: 15
Quote martbar Replybullet Posted: 17 Oct 2012 at 10:36am
maybe this will work...since the denominator is the issue
 

IF Distinctcount({EMPLOYEE.FLDID2},{EMPLOYEE.FLDLOC})=0

THEN 0

ELSE

({@fSUMVaccine-Participation}/Distinctcount({EMPLOYEE.FLDID2},{EMPLOYEE.FLDLOC}))*100

IP IP Logged
shanth
Groupie
Groupie


Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
Quote shanth Replybullet Posted: 17 Oct 2012 at 10:38am
Use Below, so when denominator is zero then 0 else calculate:
If DistinctCount ({EMPLOYEE.FLDID2}, {EMPLOYEE.FLDLOC} = 0 then 0 else
{@fSUMVaccine-Participation}/DistinctCount ({EMPLOYEE.FLDID2}, {EMPLOYEE.FLDLOC})*100
IP IP Logged
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Posted: 17 Oct 2012 at 3:37pm
Hi, this worked after I condionally suppressed any locations where the distinct count of Employee ID was 0. That and your suggested formula seemed to be the missing piece. Thanks!
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum