Division by Zero error

Hi,

In Crystal i am trying trying to show the percentage of calls that were resolved within SLA grouped by the priority of the call, for example -

High 90%
Medium 98%
Low 99%

In my database if a call is within SLA then a field called 'withininfix' has a value of 0 or 1
1 = Within fix
0 = Not within fix.

I have the following formulas for each SLA -

#P1 - This formula counts the number of high calls

If (Command.priority} <> "High" then 1

#P1_fix - This counts the number of high priority calls within SLa

if {command.withinfix} = 1 and {Command.priority} = "High"
then 1 else 0

#P1% - This formula calculates the percentage of high calls within SLA

SUM ({@#P1_fix}) / SUM ({@#P1}) * 100 & "%"

When running the report I get a division by zero error, on the #P1% formula.

Can anyone help me?
dan_stanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
#P+ is indeed 0, you get that error.
you will have to put a IF @p1 is 0, you return a fixed value (like 0)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rgonzo1971Commented:
Hi,

Like this
If (SUM ({@#P1}) ) = 0 then 0 else (SUM ({@#P1_fix}) / SUM ({@#P1}) * 100 & "%") 

Open in new window

Regards
0
dan_stanAuthor Commented:
Thanks guys
0
James0628Commented:
FWIW, you said that #P1 counts the number of high calls, but you have <> "High" in your post, so that formula is actually counting the calls that are _not_ "High".

 Also, you might want to avoid using "#" at the beginning of a formula name.  CR puts a "#" at the beginning of running total names, so if you ever use running totals, it could get a bit confusing.

 James
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.