Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum based on condition 3

Status
Not open for further replies.

Charley71

Technical User
Aug 17, 2007
31
US
I can't seem to get a summary to work the way I need it to. Seems like it should be easy but it isn't working for me. I basically just need the following

if ({provider})="nPhase" then sum({totalmegs});

This needs to sum for the entire report.

What am I missing?-thanks
 
You need to build a separate formula that runs on a per record basis.
Then build a summary based on that.

You are breaking it into two pieces.

Code:
formula {@NPhaseMegs}

if ({provider})="nPhase" 
then {totalmegs}
else 0;

then a separate summary based on that either using a summary object or built as a formula

Code:
formula {@NPhaseMegsSum}


sum({@NPhaseMegs})

Although I'll sometimes break it into three formulas; one to do the test that returns a 1 or zero, one to multiply amount by the first, and one to do the summary of the second. This gives me the ability to do the test in one and only one formula for multiple uses. I can go into more detail if you care.

 
Charley71,

Do you only want the records where {provider}="nPhase" to show up on the report and then get a sum?

If so then put {provider}="nPhase" in your record selection, put {totalmegs} in the detail section and insert a grand total sum.


If you want all {provider} records on the report but only sum those that = "nPhase", then you can do a Running Total on {totalmegs} and for Evaluate use a formula: {provider}="nPhase" and Reset Never and put it on the Report Footer.

Andy
 
All you really need to do is place a formula like the following in the detail section. Then right click on it and insert a sum at the grand total level.

if {provider}="nPhase" then {totalmegs}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top