Get the average value from the nearest date in MS SQL