I would double check the raw data. The average function will calculate over the number of table rows.
Nulls are also discarded from the calculation. for example:
Result from the average function would be 3.
zero values should be included. You check method looks valid and I would expect a match. Just double check your work.