Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Dividing by Zero Post Reply Post New Topic
Author Message
KarlaB
Newbie
Newbie
Avatar

Joined: 30 Mar 2012
Online Status: Offline
Posts: 1
Quote KarlaB Replybullet Topic: Dividing by Zero
     Posted: 30 Mar 2012 at 11:13am
Help!
 
I have 2 fields.  One prior invoice total, the other current invoice total.  I want a percentage variance.  Either may be zero.  I've tried assigning a var, I've tried if/then stmts.
 
What am I missing?
karlab
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 01 Apr 2012 at 11:16pm

Not sure which field you want as a percentage of the other so I've gone with current as a percentage of prior.... switch all the fields round if you want it the other way round.

 
if {table.previous} is null or {table.previous} = 0
then 0
else {table.current} % {table.previous}
 
Regards,
Ryan.
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