Link to home
Create AccountLog in
Avatar of Sue Taylor
Sue TaylorFlag for United States of America

asked on

Calculated field based on a subreport field divieded by main report field

I have a Non-Conformance report that has a couple of subreports.  One of the subreports displays a sum of invoices by vendor id.  My main report displays the Sum of the Total NC Cost.  I want to calculate the Impact $ which would be (Sum of @ Total NC Cost / Subreport: Sum of Command.ext_recvd)

How do I do this?  

I was reading something about variables, but I have never used them so I don't know how to use them.
Vendor-Issues---Summary.rpt
Vendor-Spend-Subreport.rpt
Vendor-Name-Subreport.rpt
SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Sue Taylor

ASKER

I created the first formula in the main report and named it calc
I created the second formula in the sub report and named it calcsubreport
I'm trying to create the third one and get a bunch of errors.

Should it really be?  Because I get errors when I enter it exactly as you wrote it down.   When I try to enter my report name in there, I get errors too.

  WhilePrintingRecords;
Shared Number{mVar SubreportTotal;
{MainReportTotal / SubreportTotal
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
My main report is a summary,  Will that work?

So my final formula on the main report is:
WhilePrintingRecords;
Shared NumberVar SubreportTotal;

Sum ({@Total NC Cost}, {@Vendor}) / SubreportTotal

I don't get any errors when I test the formula however when I try to run it I get "Division by zero" error and it highlights
Sum ({@Total NC Cost}, {@Vendor}) / SubreportTotal
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account