# Select only buckets of working day

**URL:** <https://discuss.elastic.co/t/select-only-buckets-of-working-day/304553>\
**Category:** Elasticsearch\
**Tags:** runtime-fields, eql-elastic-query-language\
**Created:** [May 12, 2022, 10:22am UTC](https://discuss.elastic.co/t/select-only-buckets-of-working-day/304553 "2022-05-12T10:22:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![imad\_orange](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/imad_orange/32/94654_2.png) [@imad\_orange](https://discuss.elastic.co/u/imad_orange)\
**Post date:** [May 12, 2022, 10:22am UTC](https://discuss.elastic.co/t/select-only-buckets-of-working-day/304553/1 "2022-05-12T10:22:20Z")

</div>

Hello,

I'm trying to calculate the average of documents by day (24h) for working days, i found that elastic calculate the average by this formula : avg = sum(docs of working days) / numberOfDays, and what i want is the next formula : avg = sum(docs of working days) / (numberOfDays - weekends).

my question is, is there a way to exclude weekends from the interval calendar ? or to delete buckets of weekends ?

Thank you

---

<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:** [May 13, 2022, 6:04am UTC](https://discuss.elastic.co/t/select-only-buckets-of-working-day/304553/2 "2022-05-13T06:04:17Z")

</div>

Hi,

As you said "formula", are you using Lens visualization of Kibana?  
If so, I have no idea about filtering weekday by the formula itself.

One possible way is creating a day of week [runtime field](https://www.elastic.co/guide/en/kibana/current/lens.html#change-the-fields).  
[Here](https://www.youtube.com/watch?v=T4bZ35E6LgE) is also a hint.

---

<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:** [June 10, 2022, 6:04am UTC](https://discuss.elastic.co/t/select-only-buckets-of-working-day/304553/3 "2022-06-10T06:04:28Z")

</div>

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