Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Division by 0 error Post Reply Post New Topic
Author Message
robbo1012
Newbie
Newbie


Joined: 29 Oct 2014
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote robbo1012 Replybullet Topic: Division by 0 error
    Posted: 09 Dec 2014 at 4:54am
Looking for some help.

Getting a Division by 0 error in my report.
My code below is working out the target v actual percentage for sales.

Sum ({@ItemsNet}, {@month})/{@Target} *100 - 100

Problem I got is that we are doing this by product group so some months there are no sales for a product group which I think is the reason for my error, just don't know how I can write into the code to ignore these instances. Works absolutely fine for the product groups with sales every month.

Any help appreciated.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 09 Dec 2014 at 7:17am
if isnull({@Target} then
 0
else 
  Sum ({@ItemsNet}, {@month})/{@Target} *100 - 100

might work
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.