Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Percentage of Items in Group Post Reply Post New Topic
Author Message
carlav60
Newbie
Newbie


Joined: 29 May 2008
Location: United States
Online Status: Offline
Posts: 9
Quote carlav60 Replybullet Topic: Percentage of Items in Group
     Posted: 13 Jan 2009 at 1:33pm
I am using XI and have been working on this problem for days.
 
I have a report that is grouped by fund (GH1), then division (GH2), with columns for "Budget" and "Expenses to Date" (and some other).  I want to find the percentage of expenses compared to budget for each division.
 
The divisions are totaled in GF1 and I can get the percentage to work for that; however, I can't figure out how to get the percentages for each individual division. 
 
I have tried every combination of GH1 and GH2 but cannot figure it out.  I am using
 
if {Whole} = 0 then 0 else
{Part} % {Whole}
 
With the whole being Budget and part being expenses to date.
 
Any ideas?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2009 at 2:22pm
If your "Division Budget" is a sum of the budget column per division and your "Division Expenses" is sum of your "Expenses to Date" column per division try this:
Do a summary function of a SUM on "Budget" at group footer 2 (Divisions). This should give you your total budget fo that Division.
Do another Summary Function on "Expenses to Date" at group footer 2 (Divisions). This should give you your total expenses for that Division.
Create a formula field:
if (sum of budget field)=0 then 0 else
(sum of expenses file)%(sum of budget field)
Your sum fields should show up as Report fields and can be dragged and dropped into your formula.
Put this formula field in group footer 2 and it should give you your percentages. You only need the if - then portion to habdle the exception of dividing by 0.
IP IP Logged
carlav60
Newbie
Newbie


Joined: 29 May 2008
Location: United States
Online Status: Offline
Posts: 9
Quote carlav60 Replybullet Posted: 14 Jan 2009 at 6:04am
Thank you for your response.  I have tried that and it does not work.  This is a example of my report.
 
 
            Dept                    Budget                YTD Trans            % Spent
(GH2)  Dept 1                 12321                   5000
(GH2)  Dept 2                 65646                   7000
(GH2)  Dept 3                 56548                   4564
(GF1)   Total                   654311                 12131                    20%
 
The Departments are a sum of each month's transactions and are grouped by Fund then Dept.  The total % spent is correct, I'm having trouble getting the dept %.
 
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2009 at 8:43am

I am not sure why that is not working. Is it returning an error, wrong values or something else?

IP IP Logged
carlav60
Newbie
Newbie


Joined: 29 May 2008
Location: United States
Online Status: Offline
Posts: 9
Quote carlav60 Replybullet Posted: 14 Jan 2009 at 8:56am
No.  I think if has to do with the grouping.  I have a specified group, such as:
 
Administration
   Human Resources
   Finance
   Accounting
 
... with all the departments grouped with their respective division.  So the HR, Finance and Accounting are a group within the Admin group, etc.  That's what's causing me the problem.  If I don't group HR, Finance and Accounting within Admin, I can get the numbers just fine.  But these departments must be grouped within their division.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2009 at 9:37am
Perhaps you could try to use conditionally defined running totals instead of SUmmary functions to handle these unique group circumstances and then use those running totals to get your percentages.
IP IP Logged
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