Conditional statement on delta if there's a series of negative numbers

127 views Asked by At

csv image here, last column is deltaSuppose there's monthly raindrop data by state, how would I pick out 3 or 4 month of continuous decrease in a row (if 0 or positive ignore the state) output should be NY and HI only.

rows are as follows:

state   time_month  rain    rain_diff
NY  Jan 79  
NY  Feb 76  -3
NY  Mar 45  -31
NY  Apr 34  -11
MO  Jan 68  
MO  Feb 69  1
MO  Mar 57  -12
MO  Apr 56  -1
HI  Jan 86  
HI  Feb 85  -1
HI  Mar 80  -5
HI  Apr 79  -1

please help fix the query below, your help is greatly appreciated

| inputlookup samples 
| delta rain as rain_diff
| table state, _time, rain, rain_diff 
| stats values(_time), values(rain), values(rain_diff) by source 
| sort _time
0

There are 0 answers