I would probably do it like this, however this doesn't provide a Rolling 24h, it simply resets after a fixed 24h period. It'd be best to have a rolling one, which would mean you'd have to store the highest value recorded over short periods (say an hour) and then compare the 24 highest recorded values over a 24 hour period to obtain the highest to display. Then start the loop again, overwriting the first value. I'd probably examine the clock on the PLC and whilst it's equal to a particular hour, do the above and at the end of the hour (when it changes to the next) store the value and compare the last 24 hours worth of stored values.