# TSVB aggregate timestamp interval backward, not forward

**URL:** https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547
**Category:** Kibana
**Created:** [February 17, 2022, 9:07pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547 "2022-02-17T21:07:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![pjago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjago/32/101966_2.png) [@pjago](https://discuss.elastic.co/u/pjago)
#### Post date: [February 17, 2022, 9:07pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/1 "2022-02-17T21:07:29Z")

</div>

Hello!

Is it possible to aggregate documents through TSVB, or Kibana by all means, where instead of grouping the timestamp forward, we do it backwads?

And as such, instead of dropping the last bucket we would drop the first bucket, since the last one will actually use documents at the bucket timestamp and previous timestamps, not following.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/a/3a64af40f46e77fcdcbb8a34c248fcdc36b8b5a8.png)

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [February 20, 2022, 3:15pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/2 "2022-02-20T15:15:22Z")

</div>

They are all based on [date histogram aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html) in Elasticsearch and it has no option to "backwards" bucketing.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [February 20, 2022, 4:35pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/3 "2022-02-20T16:35:26Z")

</div>

Hi @pjago Welcome to the community!

I think I get what you are asking ... can the buckets start from now and be defined from newest to oldest time... unfortunately we do not have that option right now... as far as I know.

The earliest time in the time range marks the time of the first / oldest / beginning buckets and the buckets are calculated forward from that point forward... which often leads to a partial "Last / Newest" Bucket that is why the option "Drop Last Bucket is there ...

In short TSVB does not support what you are asking for.

---

<div class="post-metadata">

### Author: ![wlisikpl](https://avatars.discourse-cdn.com/v4/letter/w/4af34b/32.png) [@wlisikpl](https://discuss.elastic.co/u/wlisikpl)
#### Post date: [February 20, 2022, 5:40pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/4 "2022-02-20T17:40:00Z")

</div>

> [@stephenb](#):
>
> In short TSVB does not support what you are asking for.

Maybe its time to start working on this? I also would love to see this implemented.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [February 20, 2022, 5:42pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/5 "2022-02-20T17:42:39Z")

</div>

Please feel free to open a feature request in the Kibana repo.

---

<div class="post-metadata">

### Author: ![wlisikpl](https://avatars.discourse-cdn.com/v4/letter/w/4af34b/32.png) [@wlisikpl](https://discuss.elastic.co/u/wlisikpl)
#### Post date: [February 20, 2022, 5:50pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/6 "2022-02-20T17:50:05Z")

</div>

@stephenb will not do this; Id rather clone, develop it myself than open FR.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 20, 2022, 5:51pm UTC](https://discuss.elastic.co/t/tsvb-aggregate-timestamp-interval-backward-not-forward/297547/7 "2022-03-20T17:51:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
