Cannot Summarize a Subreport Summary Field

I have several assemblies that each require multiple components.  I am calculating The extended cost per assembly in a subreport.  The subreport has the cost per component calculated by @costper := QuantityPer*STDCost.  Then I have the footer summing the total cost per assembly as Sum(@costper).  Next I have a calculation of Value Remaining as Sum ({@compCostperAss})*{?Pm-@Balance}.  This last item is being passed from the main report and is calculating what is left.  So that if I have built 5 assemblies but need 10, I am getting the value of the work left.  I am passing it to the main report as a formula in the footer:

WhilePrintingRecords;
Shared NumberVar SubTotal;
Subtotal := Sum ({@compCostperAss})*{?Pm-@Balance};
Subtotal

What I want to do now is show a total sum of this last item in the main report.  In details B I have a supressed field that shows:

WhilePrintingRecords;
Shared NumberVar Subtotal;
SubTotal

But when I try to summarize the field above in the main report it says "This field cannot be summarized."

300 pts because it's urgent!

zriveraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

frodomanCommented:
You cannot summarize any formula that is calculated during the WhilePrintingRecords step because that's the last step of the report engine.  What you'll want to do is add a variable and calculate your total manually.  Something like this:

WhilePrintingRecords;
Shared NumberVar Subtotal;
Shared NumberVar Grandtotal;
Grandtotal := Grandtotal + Subtotal;
SubTotal


Then you can show the total in the bottom of the report with the Grandtotal variable.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zriveraAuthor Commented:
That did the trick, thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.