It was not working in the case several threshold use the same datapoint