Hello. First time posting here.
I've got a SQL query questions. I'm trying to generate a column that will identify PrevValue and CurrValue by date. In the example, SP_Drift column identifies a change in CurrValue +2. The DriftTag column is where I need help. It needs to identify only in the data set where the Zone changes until it is equal to the CurrValue. In this example the data set group inside the box is correct, however, I cannot figure out to NOT include ones outside of the box. The process starts again when it finds another drift based on the SP_Drift column and start it's process again only AFTER the SP_Drift and should not tag the actual drifted row (in yellow). Any suggestions?