Counting events in a specific time range

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):

Any help appreciated.

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:

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!