Good afternoon,
I am trying to calculate the percentage difference between rows in SQL Server and need help achieving this.
I want to compare the value from [Record_Count] with the previous value from [Record_Count] and then calculate the variance in Percentage between the 2 [Record_Count] Numbers. The below table is an example of the data.
So for example I would want to compare the value in row 268 with the value in row 267 and calculate the % increase/decrease and then compare row 269 with 268 and so on.
ID | Record_Count | Variance |
---|---|---|
270 | 543 | |
269 | 28361 | |
268 | 548 | |
267 | 28464 |
Thank you in advance, any help is appreciated as I'm currently unsure on how to achieve this.