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

Excluding rows from averages... 1

Status
Not open for further replies.

BluByU

IS-IT--Management
Jul 29, 2003
35
US
I have a question about excluding certain rows from an average in impromptu 7.0. I have a column of values like this:

Tons Stump $ Stump $/Ton
100 1000 10
200 2000 10
300 0 0 <-- I want to exclude this row
400 0 0 <-- I want to exclude this row
----- ---- -----
10000 3000 0.3 <-- I want this value to be 10
by excluding the rows with 0
stump $

If I code the calculated total to be something like this:

if (stump $ > 0) then ( total(stump $) / total (tons)) else
total (stump $) / ( total(tons) - tons)

However, this only works for one row, because the running total for tons will include the amounts for the rows where stump $ are zero. Does anyone have any suggestions? Thanks!
 
BluByU
If you can't exclude the rows you don't want in the filter (Stump$ <>0), then why not divide
running total(if(Stump $<>0) then (Stump $) ELSE (0))
by
running total (If(Stump $ <>0) then (Tons) ELSE (0))
lex
 
Thanks for your response. However, the problem is not with the total on Tons, but the stump$/ton calculation. The total on tons still must be 10000, but there are 7000 tons that should not be accounted for in the average stump$/ton. Any suggestions?
 
Try this

Average = Total(Stump) / Total (if (Stump <> 0) then (Tons) else (0))
 
Thanks, that worked! I just had to change the else (0) to else (1) to avoid a divide by zero error. I really appreciate the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top