Solved

Crystal Reports Group Summary

Posted on 2013-10-23
10
729 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
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 100

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 100

Assisted Solution

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

mlmcc
0
 
LVL 22

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 100

Expert Comment

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

mlmcc
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 22

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 34

Assisted Solution

by:James0628
James0628 earned 50 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 22

Accepted Solution

by:
Ido Millet earned 250 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now