Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: % formula Post Reply Post New Topic
Author Message
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Topic: % formula
    Posted: 16 Apr 2013 at 6:15am
my % formula that i have working is doing it's job for the details portion but what i'm trying to figure out is how to get it to work on the group totals and footer fields as well.

what i'm using is this:

whileprintingrecords;

if Sum ({field1}, {group}) = 0 then
   0
else
   Sum ({field2}, {group}) * 100 / Sum ({field1}, {group})

it works as it should but at the end of my group i have a totals field that i cannot figure out how to get the percentage on and also the report footer that shows the totals of the report that i cannot figure out the percentage on.

any help would be great!

thank you!!
IP IP Logged
joeg1962
Newbie
Newbie


Joined: 01 Mar 2013
Location: United States
Online Status: Offline
Posts: 35
Quote joeg1962 Replybullet Posted: 16 Apr 2013 at 6:46am
Make a variable that:
if Sum ({field1}, {group}) = 0 then
   0
else
   Sum ({field2}, {group}) * 100 / Sum ({field1}, {group})

And paste that variable into the group level footer.
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 16 Apr 2013 at 7:38am
well i made a formula field  "Total %" that i placed into the group footer but it returns "0" instead of a variant of the total records. 
IP IP Logged
joeg1962
Newbie
Newbie


Joined: 01 Mar 2013
Location: United States
Online Status: Offline
Posts: 35
Quote joeg1962 Replybullet Posted: 16 Apr 2013 at 7:53am
First thing that comes to mind is 'rounding down to zero'. Beyond that, split the formula up to make sure the denominator is non-zero by only displaying that part of the formula; then display the numerator.
Finally, go back to the full formula.
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.