## Exclude Zeros From Average

Previous Contributor

## Exclude Zeros From Average

I am calculating an average but I do not want the zero values to be included in the average. How can I exclude them?

1 ACCEPTED SOLUTION

Accepted Solutions
Previous Contributor

## RE: Exclude Zeros From Average

You can do this by adding a line item to count the values you want to include, i.e.: add a line item 'Count' = If 'Value' <> 0 then 1 else 0.  Then you can calculate the average with a formula that is 'Value' / 'Count'. You will need to change the summary type of this line item to either 'Formula' or 'Ratio'.  If you choose ratio, you need to specify the Numerator / Denomator below, so you would select 'Value' / 'Count' in this case.
3 REPLIES 3
Previous Contributor

## RE: Exclude Zeros From Average

You can do this by adding a line item to count the values you want to include, i.e.: add a line item 'Count' = If 'Value' <> 0 then 1 else 0.  Then you can calculate the average with a formula that is 'Value' / 'Count'. You will need to change the summary type of this line item to either 'Formula' or 'Ratio'.  If you choose ratio, you need to specify the Numerator / Denomator below, so you would select 'Value' / 'Count' in this case.
Occasional Contributor

## Re: RE: Exclude Zeros From Average

How to SUM the last 4 non zero values in the time series???

Example - if i have a data as -

12,0,4,0,8,12,9,0,5,0,3,5,7,0,3

12,0,4,0,8,12,9,0,5,0,3,0,7,3,3

Any ideas????

Contributor

## Re: RE: Exclude Zeros From Average

not entirely elegant but....you'll need to use a "signal row" = if number row <> 0 then 1 else 0….next add calc row that divides ‘number row’ by "signal row" (the count)…and in blueprint mode change the calc row from sum to ‘formula’.

See attached pictures