use the latest datapoint after sorting by timestamp