# Bar Gauge Not sorting value from Grafana 8.0

**URL:** <https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650>\
**Category:** MySQL\
**Tags:** mysql\
**Created:** [June 9, 2021, 7:26am UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650 "2021-06-09T07:26:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliennycz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/juliennycz/32/16928_2.png) [@juliennycz](https://community.grafana.com/u/juliennycz)\
**Post date:** [June 9, 2021, 7:26am UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/1 "2021-06-09T07:26:11Z")

</div>

- What Grafana version and what operating system are you using?

CentOS Linux release 7.9.2009 (Core)

grafana-8.0.0-1.x86\_64

- **What** are you trying to achieve?

I want that my old bar gauge dashboard working like before 8.0 release.

I’m using a Mysql query on timeseries mode

- **How** are you trying to achieve it?

- What happened?

Before 8.0 release my values was sorted but not with 8.0 release :

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/c/d/cd3a56a8ccaae2ad4136cf93f1731bffaac8eba3.png)

I notive that only metric are sorted but not value.

- What did you **expect** to happen?

Do I have to make a special configuration to retrieve old behavior ?

- Can you copy/paste the configuration(s) that you are having problems with?

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/5/e/5e0c1131945c2530ace1f435fa89ce4d0cd13f46.png)

- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us **exactly** what they were.

- Did you follow any online instructions? If so, what is the URL?

---

<div class="post-metadata">

**Author:** ![arthurqrcapital](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@arthurqrcapital](https://community.grafana.com/u/arthurqrcapital)\
**Post date:** [July 5, 2021, 3:04pm UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/2 "2021-07-05T15:04:58Z")

</div>

I have this exact problem since the update. Found no solution yet.

---

<div class="post-metadata">

**Author:** ![kauayrocha](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kauayrocha](https://community.grafana.com/u/kauayrocha)\
**Post date:** [July 9, 2021, 7:17pm UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/3 "2021-07-09T19:17:19Z")

</div>

I have this exact problem, ☹

---

<div class="post-metadata">

**Author:** ![anon70503803](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@anon70503803](https://community.grafana.com/u/anon70503803)\
**Post date:** [July 9, 2021, 8:52pm UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/4 "2021-07-09T20:52:06Z")

</div>

@juliennycz @arthurqrcapital @kauayrocha

Have you experimented with [the `sort by` transformation](https://grafana.com/docs/grafana/latest/panels/transformations/types-options/#sort-by)?

![CleanShot 2021-07-09 at 10.49.45](https://us1.discourse-cdn.com/grafana/original/3X/a/4/a4122886ecbce0d7d3034fd33d23b91c561c5fb8.gif)

---

<div class="post-metadata">

**Author:** ![phasedarray](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@phasedarray](https://community.grafana.com/u/phasedarray)\
**Post date:** [July 28, 2021, 9:59am UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/5 "2021-07-28T09:59:43Z")

</div>

I encountered the same problem after upgrading to Grafana 8.0 with an MS SQLServer datasource.  
Changing “Format as” from “Time series” to “Table” fixed it for me. (the field is right beneath the query window)

---

<div class="post-metadata">

**Author:** ![anon70503803](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@anon70503803](https://community.grafana.com/u/anon70503803)\
**Post date:** [July 28, 2021, 9:08pm UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/6 "2021-07-28T21:08:53Z")

</div>

@phasedarray yes thank you, I did not think of that. Data frames went through a breaking change on SQL datasources in Grafana 8. [You can read more about it and how to resolve it here](https://grafana.com/docs/grafana/latest/installation/upgrading/#postgres-mysql-microsoft-sql-server-data-sources).

---

<div class="post-metadata">

**Author:** ![Alexander](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@Alexander](https://community.grafana.com/u/Alexander)\
**Post date:** [August 28, 2021, 11:14am UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/7 "2021-08-28T11:14:36Z")

</div>

I am having quite a similar issue.  
Setup:

- MySQL as input database
- Bar Gauge view
- Bar Gauge Calculation: “Last \*”

The input table has such a format:

**id; timestamp; metric\_name; metric\_value**  
id1; timestamp1; metric1; value1  
id2; timestamp1; metric2; value2  
id3; timestamp1; metric3; value3  
…  
id100; timestamp2; metric1; value 101  
…

I am retrieving the data in grafana by:

SELECT  
timestamp AS “time”,  
metric\_name AS metric,  
metric\_value  
FROM table\_name  
ORDER BY timestamp

The Bar Gauge view is now always sorting the metrics alphabetically. As already mentioned this doesn’t change if I am additionally trying to sort in the select statement or the input database is already sorted.  
Using the “Sort By” transformation doesn’t work in this case since there is no field I can select to sort by.  
Switching from “Time Series” to “Table” results in an input which cannot be used by Grafana and I am not aware how I could change my Select statement such that the output is in the needed format.

Does anybody have a clue what I could do here?

---

<div class="post-metadata">

**Author:** ![juliennycz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/juliennycz/32/16928_2.png) [@juliennycz](https://community.grafana.com/u/juliennycz)\
**Post date:** [September 8, 2021, 5:18pm UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/8 "2021-09-08T17:18:28Z")

</div>

@anon70503803 this, doing the trick on my side Thx !

---

<div class="post-metadata">

**Author:** ![kemalcolovic](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@kemalcolovic](https://community.grafana.com/u/kemalcolovic)\
**Post date:** [April 8, 2022, 1:06pm UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/9 "2022-04-08T13:06:57Z")

</div>

@anon70503803 It doesn’t work yet:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/a/a/aa1ebc64ce803eca226fa7ee461018f448db381f.png)

I have simple query that have two values to show but Bar Gague ignore the second value to show. My data source is BigQuery…  
Thnx

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [June 9, 2022, 7:26am UTC](https://community.grafana.com/t/bar-gauge-not-sorting-value-from-grafana-8-0/48650/10 "2022-06-09T07:26:43Z")

</div>

This topic was automatically closed after 365 days. New replies are no longer allowed.
