Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Grouping and Formulas Post Reply Post New Topic
Author Message
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Topic: Grouping and Formulas
    Posted: 04 Apr 2012 at 7:55am
Hello all,

I have a report with several groupings.  On the report footer and a grouping footer I am using the same formulas - sum(Total hours), sum(total direct hours) and percent (total direct hours/total hours).  Simple.

The total hours and total direct hours work as designed.  On the report footer they total everything from the report and on the group footer they total only those in that grouping.   However, the percent is using the total hours for the whole report no matter where it is?  So, on the report footer the percent is 74.43, which is correct, but it's the same for every total on the group footer also??

Can anyone shed some light on this?

Thanks!
DDavid Justice
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Apr 2012 at 8:03am
For group level data you need to use the group conditions on your summary e.g.  sum(field,group_field)
percent would be something like:
 
sum(table.directhours,table.groupfield) % sum(table.totalhours)
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 04 Apr 2012 at 9:29am
Sorry, I forgot to mention that the direct hours is the sum of a formula field

if {prhpost.orglevel2}  in ["1", "2"]
 then {prhpost.quantity}
 else 0

My formula is sum({@Direct Hours})%sum({prhpost.quantity})
DDavid Justice
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Apr 2012 at 10:32am
if i understand your set up correctly you just need to add the group condition and then place this in the group footer
sum({@Direct Hours},{table.groupfield})%sum({prhpost.quantity})
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 05 Apr 2012 at 2:13am
This is giving me an error:  'The field name is not known'

Group name is   "Group Footer #1: prhpost._orglevel1-A"

I have tried
sum({@Blind Hours},{Group Footer #1: prhpost._orglevel1-A:})%sum({prhpost.quantity})

sum({@Blind Hours},{prhpost._orglevel1-A})%sum({prhpost.quantity})

sum({@Blind Hours},{Group Footer #1})%sum({prhpost.quantity})

All of these give me the same error?




DDavid Justice
IP IP Logged
djustice
Newbie
Newbie
Avatar

Joined: 08 Feb 2012
Location: United States
Online Status: Offline
Posts: 17
Quote djustice Replybullet Posted: 05 Apr 2012 at 3:19am
OK, I finally got it: 

sum({@Blind Hours},{prhpost._orglevel1})%sum({prhpost.quantity},{prhpost._orglevel1})

Thanks for pointing me in the right direction!

DDavid Justice
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.