Calculate Average excluding zero values in cells

szadroga
szadroga used Ask the Experts™
on
I need to calculate the average for a set of numbers, but I do not want to include the zero values in my calculation.  For instance, in the month of July i have values of 8.4 and 5.2, their average would be 6.8 but my table has multiple rows for all the days in July and when i calculate the average it brings all those zero value in and makes the average extremely low.  

I am using PowerPivot and Access to get the data.  Is the a function i can use to calculate this average?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Professor JMicrosoft Excel Expert
Top Expert 2014

Commented:
you can do that with =AVERAGE(IF(A1:A10<>0,A1:A10))   old excel

and for new excel =AVERAGEIF(A1:A10,"<>0")

Author

Commented:
does this function, AVERAGEIF translate in PowerPivot?   I am getting an error message...
Professor JMicrosoft Excel Expert
Top Expert 2014
Commented:
well i thought you are using excel.

for powerpivot DAX you could try something like this

YOURAVERAGE= CALCULATE(AVERAGE(Table1[ColumnA]), FILTER(Table1, Table1[ColumnB] = EARLIER(Table1[ColumnB]))

ColumnB will be your criteria of <>0
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Top Expert 2015
Commented:
A Slight different version then Jim you can simply use..

Avg:=CALCULATE(AVERAGE([Header]),filter(Table1,[Header]>0))

Open in new window


Enclosed the workbook for your reference..Just open the powerpivot view to see more details..

Saurabh...
powerpivot.xlsx

Author

Commented:
i downloaded your xlsx file and went into PowerPivot > Manage, but its empty?  am i looking in the wrong place
Top Expert 2015

Commented:
Check at the bottom of this or create a pivot table of the data you will see avg calculated field their...

Author

Commented:
both worked, thx!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial