Handle average (sum/count) values properly

Change-Id: I852d711029d8103d66143e73928d2e0e755ea09e