Updated code to give daily averages for the specified metric