Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SSRS:  Copying a "Total" Field from a Subreport

Posted on 2013-12-20
4
Medium Priority
?
4,368 Views
Last Modified: 2013-12-23
Hello:

Although my first attachment is called "POOR_RCG_Subreport.rdl", it is actually my main report.  The other attachment is a subreport of this main report, in fact.

I'm trying to pull the "Total" field from the subreport onto the main report, so that I can have a Grand Total on my main report.

I have tried everything, but I can't get this to work.  I even took a copy of the Data Set from the subreport and made it one of the Data Sets on the main report.

How can I get this accomplished?

Thanks!

Much appreciated!

TBSupport
POOR-RCG-Subreport.rdl
POOR-RCG-Detail-Subreport2.rdl
0
Comment
Question by:TBSupport
  • 3
4 Comments
 
LVL 13

Expert Comment

by:Jesus Rodriguez
ID: 39733054
0
 
LVL 13

Expert Comment

by:Jesus Rodriguez
ID: 39733066
Also I do alittle research and they said that

Pass value from sub-report to main report is not supported by the current version of Reporting Services.

Please add additional dataset in the main report. How you aggregate in the sub-report, then how you aggregate in the main report.

Hopefully this helps.
0
 
LVL 13

Expert Comment

by:Jesus Rodriguez
ID: 39733068
If On the Main report You create another dataset equal than the dataset that contains the subreport you will be able to accomplish more or less will be like this

Create two datasets - one for the main report one that is the same used in the sub report.

Add your sub report but grab the total from the second dataset on the main report.

I'm not actually taking the info from the sub report. I'm only using the sub report to display the information correctly. I'm using the second dataset just to total what's in the sub report.

=Sum(Fields!Total.Value, "DataSource1") + Sum(Fields!ThinkTotal.Value, "DataSource2")
0
 
LVL 8

Accepted Solution

by:
vr6r earned 2000 total points
ID: 39733122
It will depend greatly on the state of your datasets.  If your subreport data is static, then k-designers above response may work very well for you.

However, if your subreport is dynamic and is generated using paramaters from your main report's dataset, things get much more difficult because in that case you wouldn't be able to add those sub-report datasets beforehand.

The best approach in this circumstance would be to re-examine your dataset queries, and the design of your main report and subreport.  For example you could potentially include the Grand Total in your main report dataset by joining and totalling the data on sql, then you wouldn't have to change your subreport at all.

Or you could redesign your subreport and instead make it a detail section of your main report, in which case you could use the normal sum functionality in SSRS without jumping through a bunch of extra hoops.

In most of my reports like this I have used a combination of the two examples I just gave.  Sub-reports can be helpful in cases where you'll need to display the same data in multiple different reports, but for most of my purposes I found that my data was so dynamic that it was easier to just combine all the data into a single report.  I also often calculate the grand totals in my sql queries because I'm already joining to get all the detail anyway, and it shifts that processing load to sql server instead of the reporting server which I have often found to be much faster in large reports with complex data.

Hope that helps!
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

783 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