Division by Zero error

Posted on 2013-09-26
Medium Priority
Last Modified: 2013-09-26

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?
Question by:dan_stan
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 1000 total points
ID: 39523945
#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)
LVL 54

Assisted Solution

Rgonzo1971 earned 1000 total points
ID: 39523950

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

Open in new window


Author Comment

ID: 39524020
Thanks guys
LVL 35

Expert Comment

ID: 39524059
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.


Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question