automatic average parsent calculation