# Create a query to obtain a user's average between two dates

**URL:** https://discuss.elastic.co/t/create-a-query-to-obtain-a-users-average-between-two-dates/360389
**Category:** Kibana
**Created:** [May 28, 2024, 2:52pm UTC](https://discuss.elastic.co/t/create-a-query-to-obtain-a-users-average-between-two-dates/360389 "2024-05-28T14:52:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Melman](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Melman](https://discuss.elastic.co/u/Melman)
#### Post date: [May 28, 2024, 2:52pm UTC](https://discuss.elastic.co/t/create-a-query-to-obtain-a-users-average-between-two-dates/360389/1 "2024-05-28T14:52:57Z")

</div>

Hello everyone,

I'm looking to create a rule that will allow me to obtain the average of a date between two dates. For example, a user usually generates logs between 8am and 6pm.

I've tried an approach with ES|QL but I'm stuck.

 ![Capture d’écran 2024-05-28 163413](https://us1.discourse-cdn.com/elastic/original/3X/1/9/19e5c261aedb64723d5e16b3286be8a787f1b7ca.png)
