# Bar chart filtered by Day Of Week

**URL:** <https://discuss.elastic.co/t/bar-chart-filtered-by-day-of-week/155743>\
**Category:** Kibana\
**Created:** [November 7, 2018, 2:51pm UTC](https://discuss.elastic.co/t/bar-chart-filtered-by-day-of-week/155743 "2018-11-07T14:51:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fre](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@fre](https://discuss.elastic.co/u/fre)\
**Post date:** [November 7, 2018, 2:51pm UTC](https://discuss.elastic.co/t/bar-chart-filtered-by-day-of-week/155743/1 "2018-11-07T14:51:42Z")

</div>

Hi,

I am trying to create a bar chart that shows how many files were updated each day of the week. The column that has this data stores it as, for example, Wed Mar 15 14:01:22. How do I filter the data in this column to create a histogram for the frequency of file uploads on each day of the week? I.e., what aggregation/filters/json input would enable this?

 ![Capture](https://us1.discourse-cdn.com/elastic/original/3X/1/2/127672a59a8d26fe1deb2380da6459bba23de65e.jpeg)

---

<div class="post-metadata">

**Author:** ![jen-huang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jen-huang/32/74327_2.png) [@jen-huang](https://discuss.elastic.co/u/jen-huang)\
**Post date:** [November 9, 2018, 8:40pm UTC](https://discuss.elastic.co/t/bar-chart-filtered-by-day-of-week/155743/2 "2018-11-09T20:40:35Z")

</div>

Hello, you can use a scripted field for this.

In Kibana, go to **Management \> Index Patterns \> Scripted fields \> Add scripted field** , and add a field like this:

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

`doc['utc_time'].value.dayOfWeek` part of the script returns the day of week in numerical form (e.g. `1` for Monday)

`["", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][doc['utc_time'].value.dayOfWeek]` simply maps the numeric value to a human readable string

(change `utc_time` to the name of your time field)

Then, you can use this new field as a Terms aggregation in Visualize:

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

---

<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:** [December 7, 2018, 8:40pm UTC](https://discuss.elastic.co/t/bar-chart-filtered-by-day-of-week/155743/3 "2018-12-07T20:40:38Z")

</div>

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