Print Page | Close Window

Grouping and Formulas

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16091
Printed Date: 03 May 2024 at 5:06am


Topic: Grouping and Formulas
Posted By: djustice
Subject: Grouping and Formulas
Date 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



Replies:
Posted By: DBlank
Date 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)


Posted By: djustice
Date 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


Posted By: DBlank
Date 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( mailto:%7b@Direct - {@Direct Hours},{table.groupfield})%sum({prhpost.quantity})


Posted By: djustice
Date 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


Posted By: djustice
Date 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



Print Page | Close Window