Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation error and subreport

Status
Not open for further replies.

eliner801

Technical User
Feb 10, 2010
6
US
I have a report which is actually a summary only report.
There are 8 columns across the top. The report is showing destinations along the left side. Across we have:
fare comm upfrt rebate adj comm chk rebate net comm
gross comm % by location and last locations gross comm as a % of the total comm rec'd. All columns calculate correctly with the exception of the last. This column needs to show the % of the total comm by location. If a location earns 116.40 in comm and the total for all locations is 1154.42 the % s/b 10.06. There are two running totals involved:
grp sub ttl comm due and grd ttl comm due. I have tried:
grp sub ttl comm due /grd ttl comm due and only the last item in the column shows the correct %. I was told by someone that I should probably do a sub report to create the totals and then use it in the existing report. I have never worked with a sub report and am at loss as to how to even begin. Is there another way to get the % in the report? I can attach a copy if someone tells me how. Thanks for any and all replies.
 
First, are you certain running totals are necessary? Please explain how the {#grpsubttlcommdue} is set up.

-LB
 
The first group is by the destination name and each gets a subtotal on the report. The last line is the total for all the destinations. When I built the report I was not getting the totals and was told I had to do a running total. It is set up as follows:
{#grpsubttlcommdue}
Field to sum: @Total Commission
Type: Sum
Evaluste:Change of Grp
Reset: Change of Grp
The grand total is the same except Reset is never.
Thanks
 
You should be able to use a summary total - this is found before anything prints, unlike the running total which 'runs' along-side the printing.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
I can see that you needed to use a running total. Your advisor was correct--you should insert a subreport to get the grand total comm. So save the current report under another name, and then insert it into the main report in a report header section. Suppress all sections within the report and remove the sub borders so that the sub does not display (you cannot suppress the subreport itself or the section it is in, and still have the shared variable work).

Then in the sub, create a formula like this:

whileprintingrecords;
shared numbervar grtot := {#grd ttl comm due};

Place this in the subreport report footer. In the main report, you can then reference the shared variable for your percentage calculation in the group footer containing the subtotal, as in:

whileprintingrecords;
shared numbervar grtot;
{#grpsubttlcommdue}%grtot;

Note that if the commission is a currency, you should change numbervar to currencyvar in all formulas.

If you need the report header to disappear, format the subreport to "suppress blank subreport" (subreport tab) and in the section expert, format the report header to "suppress blank section". You cannot suppress the report header directly and still have the shared variable work, but if this should make it disappear.

-LB
 
Thanks for all the help especially with regards to the subreport. The manuals are not really that helpful. I will work on this over the week and let you know how is going.
Again, Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top