# Order Kibana bar graph by date

**URL:** <https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533>\
**Category:** Kibana\
**Created:** [December 19, 2019, 5:35pm UTC](https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533 "2019-12-19T17:35:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergioc](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sergioc](https://discuss.elastic.co/u/Sergioc)\
**Post date:** [December 19, 2019, 5:35pm UTC](https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533/1 "2019-12-19T17:35:32Z")

</div>

Hello guys,  
I'm pretty new with Kibana and I have been trying to do a bar graph.  
I'm trying to order the bar based on dates.  
the graph shows the percentage or items by month.

 ![Capture1](https://us1.discourse-cdn.com/elastic/original/3X/2/0/20198e9a0f9da620c45db99a5ebb95361ef452b6.jpeg)  
and this is the x-axis setting  
 ![Capture2](https://us1.discourse-cdn.com/elastic/original/3X/1/1/1199a6090e52e4d50036f0232f9003f022e37a98.jpeg)  
as you can see the orders are not quite right.  
I would love it if somebody helps me with that.

Thank you

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [December 19, 2019, 6:47pm UTC](https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533/2 "2019-12-19T18:47:42Z")

</div>

Kibana does not know that this data represents months, it just looks like text. You can store it in elasticsearch as dates, and then Kibana would understand.

---

<div class="post-metadata">

**Author:** ![Sergioc](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sergioc](https://discuss.elastic.co/u/Sergioc)\
**Post date:** [December 19, 2019, 7:11pm UTC](https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533/3 "2019-12-19T19:11:06Z")

</div>

I have a date field from the one i have extracted the month and year. Im doing that on SQL but the date field is there on the index. How can i use that date field to sort?  
Thank you

---

<div class="post-metadata">

**Author:** ![Sergioc](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sergioc](https://discuss.elastic.co/u/Sergioc)\
**Post date:** [December 23, 2019, 4:26pm UTC](https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533/4 "2019-12-23T16:26:50Z")

</div>

I have managed to do it, by adding another aggregation int he graph.  
In the metrics portion i have added a new dot size aggregation and i have aggregated by my datefield converted to int.

later my X-axis i have ordered by that dot-size aggregation and that has worked perfectly.

Thank you

---

<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:** [January 20, 2020, 4:26pm UTC](https://discuss.elastic.co/t/order-kibana-bar-graph-by-date/212533/5 "2020-01-20T16:26:55Z")

</div>

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