Query to Calculate difference between current and previous values

I looks like you have already asked this question here: Compute distance between current and previous value

Please do not post the same question multiple times