Skip to content
Advertisement

Remove the time series before sequence of zero using sql

I have a time series as follows :

So I want filter data only show after final sequence of zeros that we have in time series in this case I want to get only data after 8/2/202. I have tried this

here is the result :

However this does not find the lates 0 and remove everything before that.

I want also show the result 2 days after the final zero in sequence in the table.

Advertisement

Answer

One method is:

You can offset this:

The above assumes that at least one row has zeros. Here are two easy fixes:

or:

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