# Counting events in a specific time range

**URL:** <https://discuss.elastic.co/t/counting-events-in-a-specific-time-range/282932>\
**Category:** Kibana\
**Created:** [August 31, 2021, 2:15pm UTC](https://discuss.elastic.co/t/counting-events-in-a-specific-time-range/282932 "2021-08-31T14:15:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![katja1](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@katja1](https://discuss.elastic.co/u/katja1)\
**Post date:** [August 31, 2021, 2:15pm UTC](https://discuss.elastic.co/t/counting-events-in-a-specific-time-range/282932/1 "2021-08-31T14:15:37Z")

</div>

Our problem is the following; we are collecting information about customers visiting our page. We are intrested in counting repeated visits by the same customer in a specific time range - we would like to determine the number of customers that visited the page once, twice, three times, etc.

We approached the problem by creating "customer-centric index", counting visits by each customer (total visits), time of first visit and time of last visit.

What we are missing with this solution is the possibility **to filter the visits in a specific time range**.

_For example_: If a cusotmer visited our page 2-times last month and 3-times this month, the total number of visits is 5 (which we are able to count), but we are not able to get information only for a specitic time range, for example visits in last month, where the answer would be 3-times.

We would like to present our data the following way (data not related to the above example):

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

Any help appreciated.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [August 31, 2021, 6:22pm UTC](https://discuss.elastic.co/t/counting-events-in-a-specific-time-range/282932/2 "2021-08-31T18:22:14Z")

</div>

Do you have a separate index where you're creating a document for each event (customer visit)?

If you are collecting this, then it sounds like what you'd really like is to be able to do bucket filters (e.g. "count = 1", "count = 2", etc.) which isn't currently supported by Kibana. We do have. GitHub issue tracking this request:

> <https://github.com/elastic/kibana/issues/11167>
>
> Support \[Bucket Selector Aggregations\](https://www.elastic.co/guide/en/elasticse…arch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html) to allow filtering of data table visualizations.

---

<div class="post-metadata">

**Author:** ![katja1](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@katja1](https://discuss.elastic.co/u/katja1)\
**Post date:** [September 1, 2021, 5:50pm UTC](https://discuss.elastic.co/t/counting-events-in-a-specific-time-range/282932/3 "2021-09-01T17:50:02Z")

</div>

Thank you for your answer.

Yes, we have an index where each event (visit) is collected, therefore each event also has timestamp. But by creating the "customer-centric" index, which we use for counting visits, this info is lost.  
So I wonder if there's any way around or any idea how to approach this withouth bucket filters?

Thanks for your help!

---

<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:** [September 29, 2021, 5:50pm UTC](https://discuss.elastic.co/t/counting-events-in-a-specific-time-range/282932/4 "2021-09-29T17:50:06Z")

</div>

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