The following examples use the built-in Crystal Reports function "%" to calculate percentages:

Examples of straight percentage
//Calculate value x as a percentage of value y [(x/y) * 100]
x % y

25 % 5 = 500.00%
5 % 25 = 20.00%

//if {Gift.Amount1}= $50.00 and {Gift.Amount2}= $75.00
{Gift.Amount1} % {Gift.Amount2} = 66.67%

Example of a percentage increase of decrease
//Calculate a percentage increase or decrease z of x over y:
[(y-x)%y] = z

//if {Gift.Amount1} = $50.00 and {Gift.Amount2}= $100.00 , then
[({Gift.Amount2}-{Gift.Amount1}) % {Gift.Amount2}]  = 50.00%
Note: If the denominator may sometimes be zero (0), the report will stop running and show a divide by zero warning from Crystal Reports. If you want to avoid this type of problem, you can insert a conditional test. For example:

if {Total.Amount} = 0 then 0 else {Gift.Amount} % {Total.Amount}

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Our Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.