Hello! I am having some trouble figuring out how to subtract data from the same column in one table while having multiple ID numbers to do it for within that table. Everything I have found online about this has been similar but none of them had multiple ID numbers to do it for. For instance, the other peoples problems were like this...
Date Hour Total_MWh
1/1/2000 1 182.789
1/1/2000 2 182.996
1/1/2000 3 183.006
1/1/2000 4 182.981
And from the above problem they wanted to figure out the difference between the total wmh in hour 4 and hour 3. My problem is similar but with an added twist. Here is my problem...
Date Time Card Number Mileage
1/1/2000 8:00 20 65000
1/1/2000 10:21 48 45000
1/1/2000 10:21 32 18269
1/1/2000 2:46 20 65160
And for my above problem i want to figure out the difference in mileage from the previous time recorded as above but the card numbers have to be equal to one another so that it doesn't subtract mileage from card 20 and mileage from card 32 or 48...I need it to only subtract card 20 from the previous card 20 input and so on. Any advice would be much appreciated. Thanks