Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: % of group total Post Reply Post New Topic
Page  of 2 Next >>
Author Message
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Topic: % of group total
    Posted: 24 Oct 2014 at 9:45am
I need to calculate % of one group over another of the same field. How can I do it?

Example: Total Salaries 5000
        Total Benefits 2000
I need to find % of benefits over salaries.

Thank you
Natalie
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Oct 2014 at 10:37am
sum(benefits,group)%sum(salary,group)
IP IP Logged
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Posted: 27 Oct 2014 at 5:32am
Thank you. I have tried this before but it doesn't work.
I get a message "Division by zero". Sum of each group is from one field. May be there is another way to do it?
IP IP Logged
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Posted: 27 Oct 2014 at 6:12am
IF sum(salary,group)<> 0 then
sum(benefits,group)%sum(salary,group)
IP IP Logged
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Posted: 27 Oct 2014 at 10:10am
Thank you. I tried, but for some reason the result is zero for everything.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Oct 2014 at 10:16am
what exactly is the formula you used that got the division by zero error and then exaclty the one that is only giving you the result of 0

Edited by DBlank - 27 Oct 2014 at 10:16am
IP IP Logged
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Posted: 27 Oct 2014 at 10:30am
First I created groups in the payment field.
Then I created running total fields for benefits and for salaries separately.
I used formula:
total benefits: Sum of transactionsEntryValue/total salaries: Sum of transactionsEntryValue
and I got error message.
When I used the same formula but with If total benefits<>0 then I get 0.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Oct 2014 at 10:34am
is this a crystal running total field or variable formulas?
IP IP Logged
natali
Newbie
Newbie
Avatar

Joined: 15 Jan 2013
Online Status: Offline
Posts: 26
Quote natali Replybullet Posted: 27 Oct 2014 at 10:51am
I am not sure what this is.
I used Running Total Fields in Field Explorer.
I choose field to summarize (entryValue), then to evaluate I used formula: if group is salary then true.
And, reset on change of group.
So, I got totals for each group.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Oct 2014 at 11:02am
1. running totals (RTs) only work in footers (or detail sections) so if you placed your  % formula in a header it likely would result in 0 .
2. resetting on each group makes the value go back to 0.
 
Your set up:
sounds like you have one dollar vlaue field that is defined by a type field (e.g. salary or benefit)
you grouped on the 'type' field
you created a RT to sum the dollar value field.
IN each group footer it dispaly the correct value for the benefits group and the slary group.
Now you are trying to show a %.
The % is zero.
Is this correct?
 


Edited by DBlank - 27 Oct 2014 at 11:03am
IP IP Logged
Page  of 2 Next >>
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.035 seconds.