Skip to content
Advertisement

Get Row based off Date and previous row

I’ve got the following sample data and what I’m trying to do is based off the DateChanged value is get the appropriate Amount from the linked table along with the previous row.

enter image description here

The results would then display as

enter image description here

How could this be done? What I have so far is this but wondering is there’s a better way

Advertisement

Answer

Just use lag() and join:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement