Cleaning up influxdb 2 measurement data

I have home automation that is collecting energy use data every minute. With this I can calculate pretty accurately my hourly/ daily / etc usage using SUM function. Due system error I have now one day where instead of 1440 inputs (1 per minute for 24 hrs) I have approximately 5400 input. Is there any smart way to clean up the data so that during a period the system would delete all the other datapoints but keep the first measurement for every starting minute.