I have data structured as follows: column1 = datetime, column2=int
I am needing to take the max int from each hour and subtract the max int from the previous hour. i have already broken the datetime in to the datepart but am struggling to get the previous max. The problem is that there is not data for every hour but if the previous hour is null I am needing to go to the next previous hour until there is data. Any ideas of how to structure this?