Remove duplicate values with different timestamps


I have a datasource that has multiple datapoints with the same value in different timestamps.

When visualizing the data on Grafana I hit on the limitation on the number of datapoints.

I need a query that can filter those duplicates, but I couldn’t find any function that does this. Any suggestion?