# Canvas Group By Month with Chronological order

**URL:** https://discuss.elastic.co/t/canvas-group-by-month-with-chronological-order/259066
**Category:** Kibana
**Tags:** canvas
**Created:** [December 18, 2020, 7:55am UTC](https://discuss.elastic.co/t/canvas-group-by-month-with-chronological-order/259066 "2020-12-18T07:55:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)
#### Post date: [December 18, 2020, 7:55am UTC](https://discuss.elastic.co/t/canvas-group-by-month-with-chronological-order/259066/1 "2020-12-18T07:55:53Z")

</div>

Hello,

I'm trying for some time to create a graph in canvas of unique users per month, ordered chronologically (oldest month of last year first). Whatever ESSQL query I'm trying, it seems to always order alphabetically.

```
SELECT COUNT(DISTINCT user.name) AS UniqueUsers,
DATETIME_FORMAT("@timestamp", 'MMM') AS Month
FROM "nagios" 
WHERE "@timestamp" > now() - interval 1 years AND event.dataset LIKE 'nagios.audit' AND MATCH(message,'Logged in') AND Month IS NOT NULL
GROUP BY Month

```

Result:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/1/410c7ea24cf99f2bd64e3712e6b0b6899f597003.png)

It was suggested to me to ask in the Kibana forum. Please check [Elasticsearch SQL ORDER BY Month](https://discuss.elastic.co/t/elasticsearch-sql-order-by-month/256716/6) for more info on what I've been trying.

Anyone got an idea if this is even possible and if so how?

Full expression:

filters

```
| essql

query="SELECT COUNT(DISTINCT user.name) AS UniqueUsers,

DATETIME_FORMAT(\"@timestamp\", 'MMM') AS Month

FROM \"nagios\"

WHERE \"@timestamp\" > now() - interval 1 years AND event.dataset LIKE 'nagios.audit' AND MATCH(message,'Logged in') AND Month IS NOT NULL

GROUP BY Month"

| pointseries x="Month" y="UniqueUsers"

| plot defaultStyle={seriesStyle bars=0.75} legend="ne"

| render

```

Thanks!

Willem

---

<div class="post-metadata">

### Author: ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)
#### Post date: [December 18, 2020, 9:09pm UTC](https://discuss.elastic.co/t/canvas-group-by-month-with-chronological-order/259066/2 "2020-12-18T21:09:25Z")

</div>

What version of the stack are you running? There's a known regression with sorting in the `plot` function starting in 7.9.

If you are running 7.9 or higher, you can follow along with the issue here: [https://github.com/elastic/kibana/issues/62770](https://github.com/elastic/kibana/issues/62770)

---

<div class="post-metadata">

### Author: ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)
#### Post date: [December 18, 2020, 9:35pm UTC](https://discuss.elastic.co/t/canvas-group-by-month-with-chronological-order/259066/3 "2020-12-18T21:35:12Z")

</div>

@lukeelmers Thank you for this information, we are running 7.9.2. This issue seems related. I'll follow progression there.

---

<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 15, 2021, 9:35pm UTC](https://discuss.elastic.co/t/canvas-group-by-month-with-chronological-order/259066/4 "2021-01-15T21:35:14Z")

</div>

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