?
Solved

Crystal Reports Group Summary

Posted on 2013-10-23
10
Medium Priority
?
739 Views
Last Modified: 2013-10-27
I have the following dataset:

Job,Hierarchy,TotalBudget,Actual
30001666,400402,60000,5000
30001666,400402,60000,10000
30001666,400402,60000,3000
30001666,400402,60000,15000
30001666,400403,20000,18000
30001666,500504,10000,2000
30001666,500504,10000,3000
30001666,500504,10000,1000
30001666,500504,10000,4000
30002000,400402,65000,500
30002000,400402,65000,1500
30002000,400402,65000,2000
30002000,500604,70000,1000
30002000,500604,70000,2000
30002000,500604,70000,3000
30002000,500604,70000,2000

Using Crystal Reports 2008 I want to group by Hierarchy and then Job and include summary totals in the group headers.

The difficulty is that the TotalBudget in each record is the total for Hierarchy and Job combination so should be displayed as is, not be summed, in the Job group header. I then want the sum of the Total Budget value displayed in the Job group header to be summed to the Hierarchy group header.

The Actual value for each record needs to be summed to the Job group header and the Hierarchy group header.

The output I need in the report is as follows. The left hand column is the section structure. Hopefully it makes sense.

Required Report Output
Help would be greatly appreciated.
0
Comment
Question by:Morgs77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 39596268
There is probably a SQL solution to get what you want in a query.

In Crystal you probably need to use a subreport to get the GH1 total for budget

Actual totals can be calculated with a summary.

What database are you using?

mlmcc
0
 

Author Comment

by:Morgs77
ID: 39596286
Thanks. I can get the Actual totals fine, it is the TotalBudget totals that are causing me trouble. I had considered using a subreport but was hoping there was another way around it.

The data is from an SQL Server 2008 database.
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 800 total points
ID: 39596306
You could look at the SQL Expression.

mlmcc
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 23

Expert Comment

by:Ido Millet
ID: 39596885
You simply need to create a Running Total and select the option to evaluate only once for each Group Level 2.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39597264
A running total won't work because he wants it displayed in the group header.

mlmcc
0
 
LVL 23

Expert Comment

by:Ido Millet
ID: 39597889
Correct; Running Totals would work only if the user is willing to see the totals in the Group Footer.
0
 

Author Comment

by:Morgs77
ID: 39599757
Thanks for the help so far. The running total does give me the values I need, but I really need them in the group header. I will try a subreport but if there is any other way to do it I would like to try.
0
 
LVL 35

Assisted Solution

by:James0628
James0628 earned 200 total points
ID: 39599912
As mlmcc mentioned earlier, you could try a SQL Expression.  That lets you create a sort of sub-query to gather information from the tables.  If that option is available in your report, it should be listed in the Field Explorer.  I've never used them (they weren't an option for most of my reports), but that might give you what you need.

 James
0
 
LVL 23

Accepted Solution

by:
Ido Millet earned 1000 total points
ID: 39600071
If you must place the information in the header, here is the structure of the SQL Expression that would solve this:

(SELECT Sum(`TotalBudget`) FROM Budget as B WHERE (`B`.`Hierarchy ID` = `Budget`.`Hierarchy ID`) )
0
 

Author Closing Comment

by:Morgs77
ID: 39604718
Thanks for all the input. I got it to work with an SQL Expression along the lines suggested by IdoMillet. I had not used this feature before and did not know it existed so it took a while realise what was being suggested. Thank you for all the help.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question