Add command function to call average and sum function