Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Group Totals Post Reply Post New Topic
Author Message
Joe M
Newbie
Newbie


Joined: 06 Feb 2012
Online Status: Offline
Posts: 3
Quote Joe M Replybullet Topic: Group Totals
     Posted: 06 Feb 2012 at 7:46am
I am creating a report for a construction company. There are two types of expenses I am interested in. Actual Expenses and Budgeted Expenses. Each Expense type is broken into categories for which I have created a group. For example, Materials Cost, Subcontractor Cost, Permits Cost, etc.

For Actual Expenses, I have each individual expense printing in the details section and then each section is subtotaled in the group footer.

Here is my question. How do I get the Budget Expense type next to the Actual Expense type in the group footer? When I simply drag Budget Expense field next to the calculated Actual Expense field in the Group Summary my report fails and I get duplicate instances of Actual Expenses.

If I am being vague please ask questions and I'll try to be more specific. Any suggestions?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2012 at 8:09am
my guess is that your budget expenses are in a different table and you have not used any fields from that table in the report (prior to dragging the "actual" field next to the budget field).
When you drag the field it is enforcing the join on your report which is in turn making duplicate rows appear (creating your data set).
If this is accurate then your data set will have duplicate rows based on your table joins. You will likely need to use variable formulas or running totals so get your values/totals for both budgeted and actual.
IP IP Logged
Joe M
Newbie
Newbie


Joined: 06 Feb 2012
Online Status: Offline
Posts: 3
Quote Joe M Replybullet Posted: 08 Feb 2012 at 5:39am
DBlank,
You are correct with your assumptions. The data is in separate tables and budget had not been used in the report until placed in the group footer.

Whereas each group may have multiple line items for actual expenses, budget expenses only has one line item. I am trying to place that one line item for budgeted expense in the group footer next to the subtotaled actual expense.

Could you assist me in writing the formula that looks at which group is the current group, pulls the proper number from another table (based on current group)and places that number in the group footer? I am stumped.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Feb 2012 at 6:16am
you will still need to deal with "duplicate rows" (unless you want to write a stored procedure or soemthing akin to it and use that as your source).
Calling a field in a formula enforces the join the same as placing it on the canvas.
 
can you show one sample grouped data and how you want it to summarize in the footer?
IP IP Logged
Joe M
Newbie
Newbie


Joined: 06 Feb 2012
Online Status: Offline
Posts: 3
Quote Joe M Replybullet Posted: 08 Feb 2012 at 7:47am
Sample Grouped Data:

Group: Materials Expense
Description   Act Cost   Est Cost
Vendor1        1,000
Vendor2        2,000
Vendor3        3,000
Total            6,000      4,500

There are three items in actual cost that Crystal Sums up to $6,000. The $4,500 is pulled from a table that has three fields; Job Number, Group Name and Amount. It is the $4,500 that I can't figure out how to place into the group footer w/o the report failing.

More details about the report. All reports are based on a job Number. Each job number can have multiple groups. For example: Materials Cost, Subcontractor Cost, Permits Cost and Revenue to name a few.

Thanks for helping with this!



Edited by Joe M - 08 Feb 2012 at 7:48am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Feb 2012 at 8:21am

when you say the report fails does that mean it crashes or it duplicates lines?

Basically you need to try and get your dataset after joining the tables
Don't try and build any part of the report until you know what the actual returned data set looks like.
the 4500 is easy to get if your data is alerady joined.
it is a running total as a SUM of the ext. cost field set to evalaute once per group and reset a the same group.
However I don't think what you gave me is the actual raw data set with all of your joins and fields added to the set.
With those you can often use a Primary Key from a table as a reset or evaluation trigger.
basically you have to get your data set all lined up beofre you build anything. Otherwise you will be working in shifting sand and never really get anywhere.
So with all of your joins set up (and enforced)
what doesw your raw data set look like that you want to eventually look like the sample above?
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