Sue Taylor
asked on
Crystal Report Grand Total in Main Report from Sub Reports
I need some help on how to get a Grand Total of Vendor Spend from the Vendor Spend subreport into my main report. Ultimately, I want to get the overall percentage of Total NC Dollars vs. Vendor Spend.
Please realize that the Vendors listed will change based on whether or not there was an Nonconformance (NC) written up for them and/or the time frame I am running the report for.
I'm at a loss as to what and where I would enter variables for this.
--mail-staylor--Custom-Reports-uniPo.rpt
Please realize that the Vendors listed will change based on whether or not there was an Nonconformance (NC) written up for them and/or the time frame I am running the report for.
I'm at a loss as to what and where I would enter variables for this.
--mail-staylor--Custom-Reports-uniPo.rpt
I looked at the report. I don't see a problem unless the values are incorrect.
I think your formula in the group footer has the division reverses
mlmcc
I think your formula in the group footer has the division reverses
WhilePrintingRecords;
Shared NumberVar SubreportTotal;
If Sum ({@Total NC Cost}, {@Vendor}) = 0 then
0
Else
SubreportTotal / Sum ({@Total NC Cost}, {@Vendor}) * 100
mlmcc
ASKER
I did something wrong. Instead of getting the grand total, I'm getting the total of the last vendor on the page right before the report footer.
--mail-staylor--Custom-Reports-uniPo.rpt
--mail-staylor--Custom-Reports-uniPo.rpt
The formula should be
mlmcc
--mail-staylor--Custom-Reports-uniPo.rpt
WhilePrintingRecords;
Shared NumberVar SubreportTotal;
If Sum({@Total NC Cost}) = 0 then
0
else
SubreportTotal / Sum ({@Total NC Cost}) *100
mlmcc
--mail-staylor--Custom-Reports-uniPo.rpt
ASKER
I must not have explained myself correctly. I'm not getting the GRAND TOTAL of all the Vendor Spends from my subreport in my Main Report. The current formula gives me the total spend for the last vendor on any given page.
I want the totals for all vendors, so on the example I attached Called "Example 1" it shows the Grand Total of $68,440.44 (in Lime Green). That's the same as the total vendor spend for my last vendor, 1206604 - Dayang Fastener Factory. What I need it to display is the Grand Total of $94,246.76, which is $16,508.70 + $9,297.62 + 0 + $68,440.44
C--Users-staylor-Desktop-Example-1.pdf
I want the totals for all vendors, so on the example I attached Called "Example 1" it shows the Grand Total of $68,440.44 (in Lime Green). That's the same as the total vendor spend for my last vendor, 1206604 - Dayang Fastener Factory. What I need it to display is the Grand Total of $94,246.76, which is $16,508.70 + $9,297.62 + 0 + $68,440.44
C--Users-staylor-Desktop-Example-1.pdf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the main report add a formula to the report header
Open in new window
In the subreport add a formula to set the value. Change 100 to whatever formula or field you use to calculate the value.
Open in new window
To use the value in the main report add a formula. The key is this formula has to be in a section after the section the subreport is in. The reason is the subreport is the last object rendered/evaluated in a section so formulas in that section are calculated before the shared value is updated.
A formula to display the Vendor spending from the subreport
Open in new window
mlmcc