This tutorial will walk you through SQL server on using the Lead or Lag function. Adding this to your SQL select statement, it can output you the previous/next data value in the partition. This is very useful when wanting to see a particular data value a customer had prior to making a change.
Github Script:
https://github.com/ProfessorPitch/ProfessorPitch/blob/master/SQL/Window%20Functions/Lead%20Lag%20Exercise.sql
Lag:
https://docs.microsoft.com/en-us/sql/t-sql/functions/lag-transact-sql?view=sql-server-2017
Lead:
https://docs.microsoft.com/en-us/sql/t-sql/functions/lead-transact-sql?view=sql-server-2017