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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Omit zeros when averaging numbers

Status
Not open for further replies.

deborahyr

Technical User
Nov 14, 2002
63
US
Using Crystal 11, I'm creating a age field if employee is an incumbent in a position.

if (field) = "incumbent" then 1 else 0
if (incumbent) = 1 then (age) else 0

in the report footer, I wanted to add summaries for average age by category. using example above, how do I get it not to count 0's and just average those identified with an age as above?

category age
incumbent 45
talent 0
incumbent 42
talent 0
talent 0
my average for incumbent should = 43.5 not 17.4
Help!!!
 


Insert a Running Total for Average, and in the Evaluate section, check "Use a formula", open the X-2 box and type in {@age}>0.
 
Thanks for the quick response. In the meantime, I tried another trick.

Running total - summarized (age)field, average
evaluated using formula - (incumbent field) = 1
Never reset

it worked! ;)
 
to piggyback this, how do i show this in a stacked bar chart?

incumbent avg age
incumbent avg tenure

using these running totals fields from my report footer
 
Have you tried Insert > Chart? It does most of the work for you.

If there's still a problem, please start a new thread for a new topic.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top