Hi everyone,
I have the following input :
ID | Value | Date | |
---|---|---|---|
B537D | 5400 | 13-10-2014 12:00:00:00000 | |
2H45P | 5500 | 13-10-2014 13:00:00:00000 | |
V5JS2 | 5800 |
| |
... | .... | .... |
This input is sorted.
My goal is to retrieve the difference between actual value and previous hour value.
For exemple, for the second line, i would like to have the following output :
ID | Value | Date | Difference |
---|---|---|---|
B537D | 5400 | 13-10-2014 12:00:00:00000 | *** |
2H45P | 5500 | 13-10-2014 13:00:00:00000 | 100 |
V5JS2 | 5800 | 13-10-2014 14:00:00:00000 | 300 |
How can i proceed to get the following threatment : value of the processed column minus the value of the previous hour.
My second aim is to propose an aggregate on a daily basis, but there's a trick : my day start at 10 AM and ends at 5AM the next days.
I'm thinking about defining variables but nothing specific.
Any help would be greatly appreciated.
Guillaume