Solved

Sum of a Sum Formula Field

Posted on 2011-03-07
18
626 Views
Last Modified: 2012-08-14
I need to Sum a Formula Sum field.  I've heard that to “Sum a Sum field” you need to use manual summaries.  Here’s what I have.  

FORMULA – @TotalCost

{WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST}

TotalCost is now displayed in each Location Header – works great.  Now I want to take the @TotalCost of each Location – and get a Grand Total in the Report Footer?  

Thank you for your assistance.  
0
Comment
Question by:washvt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 4
  • +1
18 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 167 total points
ID: 35061379
Your formula suggests that you are adding up values from the first record in each group.  Is that what you intend?

To create a grand total you need 2 more formulas.. I am assuming these are currency fields; if they are number you need to modify the variable declaration.

In the report header

Whileprintingrecords;
Currencyvar Gtot:=0;
""
Change  your current formula field :

Whileprintingrecords;
Currencyvar Gtot;
Gtot:=Gtot+ {WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST};
{WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST}

In the report footer:

Whileprintingrecords;
Currencyvar Gtot;
Gtot
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 167 total points
ID: 35061464
I think he has a summary of that "field" or formula

If that is the case then simply create another summary of the formula and put it in the report footer or header.

mlmcc
0
 
LVL 35

Assisted Solution

by:James0628
James0628 earned 166 total points
ID: 35067987
If you want to get a grand total of that formula, but only include the values once for each Location, you could use formulas like the ones that Peter posted, or use a running total on that formula, set it to evaluate "On change of group" (or field), and chose the Location group (or field).  Then that formula will only be added to the total once for each Location.

 James
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:washvt
ID: 35084382
Thank you Peter.  I used your formulas - however I'm still getting $0.00 in the footer and header?  Thank you.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35085703
Can you show the formulas you are usnig and where you placed them?

mlmcc
0
 

Author Comment

by:washvt
ID: 35086900
Formuals created - No I created formulas and placed them in the Header, Fooder, and Group - should I have used Selection Expert for each section and created the formulas there?

Group Header for LOCATION.LOCATION (this works fine - getting the total I'm looking for)

Currencyvar Gtot;
Gtot:=Gtot+ {WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST};
{WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST}

Header

Whileprintingrecords;
Currencyvar Gtot:=0;


Footer

Whileprintingrecords;
Currencyvar Gtot;
Gtot

Thanks.
0
 
LVL 35

Expert Comment

by:James0628
ID: 35087162
You should have Whileprintingrecords in the first formula too.  Without that, the formula may produce the correct total on the report, but not be updating the Gtot variable properly.

 When you said before that you were getting 0 in the footer and header, did you mean a group footer and header, or the report footer and header?  The formula in the report header will only produce 0, because it's creating the Gtot variable and setting it to 0.  If you don't want to see that 0 on the report, you can add "" at the end (as in the formula that Peter posted), so that the formula produces no visible output, or suppress that formula, or the entire report header section, if there's nothing else in that section that you need to see.

 If you want to actually see the final total in the report header, you can't do that this way.  The Gtot variable will be updated as the records are read, and it won't have a total until the last record has been read.

 James
0
 

Author Comment

by:washvt
ID: 35087272
Getting $0.00 in Report Footer and Header.  

I did add the "" at the end of the formula and am not seeing the $0.00.  

So - now thta I'm seeing my totals correctly - how do I get a grand total for the Location totals?

i've attached a sample.  Thank you for your assistance.

Location-Asset-Hiearchy-with-Cos.docx
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35087313
THe footer formula should show the total.

As stated above change this formula

Group Header for LOCATION.LOCATION (this works fine - getting the total I'm looking for)

Currencyvar Gtot;
Gtot:=Gtot+ {WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST};
{WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST}


to

Group Header for LOCATION.LOCATION (this works fine - getting the total I'm looking for)
WhilePrintingRecords;
Currencyvar Gtot;
Gtot:=Gtot+ {WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST};
{WORKORDER.ACTMATCOST}+{WORKORDER.ACTLABCOST}+ {WORKORDER.ACTTOOLCOST} + {WORKORDER.ACTSERVCOST}

mlmcc
0
 

Author Comment

by:washvt
ID: 35087780
Thanks so much - closer.  Now I have Report Footer is totaling the Loations on the second parge only - not both pages.  Where should the Footer reside to get the costs from each Location?

See Attached.  Thanks.


Locatioon---Asset-Hierarchy-Cost.pdf
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35089524
You would want it in the Page Footer however it will post the current total at that point not the overall total.

mlmcc
0
 

Author Comment

by:washvt
ID: 35100512
Thank you - I know have the formula in the Page Footer and I'm seeing the total per page.  Am I correct - there is no way to total both pages to one GRAND TOTAL?  Thanks again.
Locatioon---Asset-Hierarchy-Cost.pdf
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35103147
The one on each page should be the total to that point not just for the page.

Did you put the first declare in the page header rather than the report header?
Whileprintingrecords;
Currencyvar Gtot:=0;
""
mlmcc
0
 
LVL 35

Expert Comment

by:James0628
ID: 35115009
You're welcome.

 FWIW, I think maybe some of the points/credit should go to mlmcc.  If nothing else, I'm guessing that his last post helped you fix the grand totals.

 James
0
 

Author Comment

by:washvt
ID: 35141609
I would like to thank all for posting solutions.  Would like to open case - so I can give all credit for responses.

Thank you again.

James0628:
mlmcc:
peter57r:
0
 
LVL 35

Expert Comment

by:James0628
ID: 35146262
You're welcome again.  :-)

 James
0
 

Author Closing Comment

by:washvt
ID: 35334964
Thank you.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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