Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Division by zero in CrossTab Post Reply Post New Topic
Author Message
Megan10e
Newbie
Newbie


Joined: 19 Aug 2010
Online Status: Offline
Posts: 24
Quote Megan10e Replybullet Topic: Division by zero in CrossTab
    Posted: 12 Oct 2010 at 8:29am
I'm trying to do a calculated member in a cross tab report, to show the difference in percentage from one year to the next. Some of the values are zero, though, and Crystal won't run the calculation when there is division by zero.
 
How can I edit this formula to take care of that? Here is the formula Crystal comes up with when I try to do my calculated member:
 
//The calculation formula is used in place of the summaries in Calculated Members.
// This calculation formula must return a/an Number value.
GridValueAt(CurrentRowIndex, GetColumnPathIndexOf("Jan 2009"), CurrentSummaryIndex) / GridValueAt(CurrentRowIndex, GetColumnPathIndexOf("Jan 2008"), CurrentSummaryIndex)
 
Thank you!
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 12 Oct 2010 at 1:14pm
How about this:

if GridValueAt(CurrentRowIndex, GetColumnPathIndexOf("Jan 2008"), CurrentSummaryIndex) = 0 then
  0
else
  GridValueAt(CurrentRowIndex, GetColumnPathIndexOf("Jan 2009"), CurrentSummaryIndex) / GridValueAt(CurrentRowIndex, GetColumnPathIndexOf("Jan 2008"), CurrentSummaryIndex)
 

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.