What you're asking for is complicated and if you determined to go down this path you will need to be very familiar with SQL and / or have someone that can do SQL for you.
I would suggest a different path for you to try:
- Collect baseline temperature data from your devices
- Create 2 node custom properties ( temperature_warning and temperature_critical).
- On a node by node basis, set the custom properties to the average temperature +4 and +8 degrees (you pick the number).
- Write an alert that compares the current temperature against the custom properties.
As a side note, I don't think 4 degrees over 24 hours will be of much operational help. Usually when temperature starts climbing in a datacenter, it is because something is really wrong. The temperature rise could be up to 10 degrees in < 1 hour (depending on the size and density of your datacenter).
Also, know that most modern devices have internal shutdowns integrated into them so they don't melt down. At least your hardware will survive a massive temperature change in the datacenter.
A final note: I thought it was interesting to take all the temperature sensors from all the devices in a datacenter / room / location and try and determine the average ambient temperature there.
I've posted the report here http://thwack.solarwinds.com/docs/DOC-173967