is there a way in TSQL to have a running total that also checks for criteria?
For example I know that using a windowed function I can create the running total that partitions against storenumber and weekstartdate as shown in column D.
I also want the function to check the criteria in column E and when it hits the criteria I want the running total to stop. I know I can do that with a CASE statement.
However I want the running total to restart when it hits the next week as shown in the example.
Any ideas on how to accomplish this?