Solved

# Adding a Percentage Comparison Formula in Crystal Reports

Posted on 2008-10-17
1,340 Views
Hi

I am very new to Crystal Reports especially when it comes to adding numerous different formulas and conditions.
I have a report I have made which works in everyway it should including most formula except the percentage ones.  I need to find the percentage difference from 2 values.  I have created4 if, then else formula and 2 sum formula to add relevant values to gether.  These are fine.  My database contains no numerical values only string text and dates.  I created If, then else formula to add different statuses together and sum to add each of these together.  I need to create a percentage formula to caluclat edifference between the 2 SUM values but this is not working.  I tried insert summary and selecting option for percentage difference but this only gave me option to pick one field which is not the one I need.

Any ideas or pointing me in right direction

Many Thanks
0
Question by:stefone
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3
• 2

LVL 16

Expert Comment

ID: 22740461
well to find the % diff, it is a simple formula.
A = 0
B = 2

if isnull(A) or A= 0 then 0
else (A/B)*100

A and B represent your fields.
0

LVL 101

Expert Comment

ID: 22741074
That is a percentage not a difference.

I think you really need

(A-B)/B

mlmcc
0

LVL 16

Expert Comment

ID: 22741107
Opps.. yeah you are right.. but my head was in the right direction.. hehehe.
0

LVL 101

Expert Comment

ID: 22741355
Also you should check if B is 0 to avoid a 0 divide error

mlmcc
0

Author Comment

ID: 22758574
Hi

Thanks for comments.  I am almost there but as per you comment mlmcc I do have nil values for field b.  creating the if function ho wdo i incorporate the second field b = 0 into the formula

Thanks
0

LVL 101

Accepted Solution

mlmcc earned 50 total points
ID: 22758707
Somethin glike

If B = 0 then
0
else
(A-B)/B

mlmcc
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Statement In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereb…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
###### Suggested Courses
Course of the Month3 days, 16 hours left to enroll