This was what I used for testing. The reason to group by month when using streamstats is to ignore the last result of the previous month. | makeresults
| eval i="2022-09-01,0;2022-09-02,0;2022-09-03,12;2022-09-04,0;2022-09-05,55;2022-09-06,83;2022-09-07,111;2022-09-08,0;2022-09-09,0;2022-09-10,0;2022-09-11,167;2022-09-12,227;2022-09-13,0;2022-09-14,0;2022-09-15,0;2022-10-01,0;2022-10-02,0;2022-10-03,12;2022-10-04,0;2022-10-05,55;2022-10-06,83;2022-10-07,111;2022-10-08,0;2022-10-09,0;2022-10-10,0;2022-10-11,167;2022-10-12,227;2022-10-13,0;2022-10-14,0;2022-10-15,0"
| eval i=split(i, ";")
| mvexpand i
| rex field=i "^(?<event_date>[^\,]*)\,(?<done_ct>.*)"
| eval _time=strptime(event_date, "%Y-%m-%d")
| eval event_month=strftime(_time, "%Y-%m")
| table _time event_month event_date done_ct
| sort 0 _time
```sum(eval(if(ItemsPurchased<0,0,ItemsPurchased)*UnitPrice)) ```
| streamstats current=f global=f max(done_ct) AS last_ct BY event_month
| fillnull value=0 last_ct
| eval apples_picked=IF(done_ct>last_ct, dont_ct-last_ct, 0)
... View more