Solved

How to get a summary of a calculation from a subreport to the main report in Crystal Reports 2008

Posted on 2013-01-11
7
936 Views
Last Modified: 2013-01-11
Hi,
      I have a subreport placed in the group header of a main report in Crystal Reports 2008. The subreport has an average calculated for the records in it using a formula (Sum/Count). So, the main report shows an average for each group as the subreport is placed in the group header. Could anyone tell me how to get the total average on the main report for the field which is in the subreport ?


Thanks in advance.
0
Comment
Question by:pradeepdevineni
  • 3
  • 3
7 Comments
 
LVL 22

Expert Comment

by:Ido Millet
ID: 38767036
Set the value of a Shared variable in a subreport formula.  A main report formula in a section BELOW the subreport section (in your case, a good choice would be in the Group Footer section) can then declare the same shared variable name and gain access to the value in it.
0
 

Author Comment

by:pradeepdevineni
ID: 38767260
Thanks for your quick reply. I used the shared variables and got the average to display on the group footer of the main report. The result in the main report now shows an average for each group. This is the first part of my question which is solved.

Now, How can I get the "Total Average" (which means the average of all the records in all the groups) to display on the Report Footer of the main report ?

I tried to put the main report formula in the Report Footer of the main report. It didn't work. Do I have to change the location of the subreport ? I still need both the group averages and the Total average.
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 38767284
Since you now have access to the data in the subreports, just decide what you want to do with that data.  You can use other variables to accumulate the Grand Total Value and Grand Count, so that in the Report Footer you can divide one by the other to get the desired Grand Average.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:pradeepdevineni
ID: 38767571
I used shared variables to get the group sum and group counts from the subreport to the main report and divided them to get the Group average.

I tried to create running totals for the group sum and group counts in order to create the Grand sum and Grand counts. It doesn't let me do the running totals. I could see the group sum and group counts formulas in the Formula Fields of Field Explorer. But for some reason, I dont see the group sum and group count formula fields in the "Create Running Total Field" window in order to summarize.

Do you know why they are not showing up ? And could you provide a solution to this ?
0
 
LVL 22

Assisted Solution

by:Ido Millet
Ido Millet earned 250 total points
ID: 38767609
You can't do a Running Total on "Print Time" formulas (shared variables make any formula a Print Time (2nd pass) formulas).  Instead, you have to use variables in formulas to accumulate the group values into Grand totals.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 38768071
Change your group average formula

WhilePrintingRecords;
Global NumberVar GrandTotal;
Global NumberVar GrandCount;
Shared NumberVar GroupTotal;
SharedNumberVar GroupCount;
GrandTotal := GrandTotal + GroupTotal;
GrandCount := GrandCount + GroupCount;
GroupTotal / GroupCount

In the report header add a formula
WhilePrintingRecords;
Global NumberVar GrandTotal;
Global NumberVar GrandCount;
""

In the report footer calculate the overall average
WhilePrintingRecords;
Global NumberVar GrandTotal;
Global NumberVar GrandCount;
GrandTotal / GrandCount

mlmcc
0
 

Author Comment

by:pradeepdevineni
ID: 38768279
Thank you. That really worked.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

930 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

16 Experts available now in Live!

Get 1:1 Help Now