BAQ Running Sum

I think the BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING part might not be needed, or maybe overly specific. I think by default it uses only the previous row.

There’s some more good info in this post about how that code works.