Skip to content
Advertisement

window function rolling sum

I have a window function that gives me a rolling sum as below:

but when some timestamps in the start_time column are equal the rolling sum stays the same, which makes sense bc I am ordering by start time, but it does not properly add the duration_seconds in the rolling sum as below: how can i fix or account for this?

desired:

Advertisement

Answer

If you add the duration_seconds column to the order by in the partition, that should give you what you’re looking for.

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