# Time Filter behaving strangely

**URL:** <https://discuss.elastic.co/t/time-filter-behaving-strangely/214680>\
**Category:** Kibana\
**Created:** [January 10, 2020, 10:38pm UTC](https://discuss.elastic.co/t/time-filter-behaving-strangely/214680 "2020-01-10T22:38:51Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [January 14, 2020, 2:50pm UTC](https://discuss.elastic.co/t/time-filter-behaving-strangely/214680/16 "2020-01-14T14:50:56Z")

</div>

You are right, `derivative` is causing your problem. This is the underlying code:

```auto
      eachSeries.data = _.map(pairs, function(point, i) {
        if (i === 0 || pairs[i - 1][1] == null || point[1] == null) {
          return [point[0], null];
        }
        return [point[0], point[1] - pairs[i - 1][1]];
      });

```

It will output the difference to the data point before the current data point, but won't skip null values.

Could you try applying `fit` before `derivative`? Then it should fill in the missing values before calculating the derivative, which should give you the derivative of the existing values. In this case `fit(none)` should be the right choice because it basically just gets rid of the null data points in between.

```auto
.es(index=bindjson*,timefield='@timestamp', metric=max:qtypes.A).fit(none).derivative().label("A").lines(fill=2,width=1).color(#03f4fc),

```

---

_[View the full topic](https://discuss.elastic.co/t/time-filter-behaving-strangely/214680)._
