building an average variable value per cluster in a table