Solved

Sum of a Sum Formula Field

Posted on 2011-03-07
18
589 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
  • 7
  • 5
  • 4
  • +1
18 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 167 total points
Comment Utility
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
Comment Utility
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 34

Assisted Solution

by:James0628
James0628 earned 166 total points
Comment Utility
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
 

Author Comment

by:washvt
Comment Utility
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
Comment Utility
Can you show the formulas you are usnig and where you placed them?

mlmcc
0
 

Author Comment

by:washvt
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
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
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
You're welcome again.  :-)

 James
0
 

Author Closing Comment

by:washvt
Comment Utility
Thank you.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now