Grafana Stacked Graph with MySQL

Hey All,

I have a table as below:

 CREATE TABLE `priority` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `priority` int(3) NOT NULL,
   `count` int(11) NOT NULL,
   `group_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `day_opened` DATETIME NOT NULL
   PRIMARY KEY (`id`)

Basically im trying to do a stacked bar chart, it should group everything by month(day_opened) and then stack everything in the month by priority but show the count.

I setup multiple queries, one for each priority, thinking it should stack anything that is in the same month e.g. June.

   day_opened AS "time",
   MONTHNAME(day_opened) AS "metric",
   sum(inc_count) AS "P2"
 FROM inc_priority
   $__timeFilter(day_opened) and 
   group_name = "TheTeam" and
   priority = "1"
 GROUP BY queue_name
 ORDER BY day_opened

so far all i get is two columns with June on the X Axis and the count on the Y Axis, but they arent stacking even though i have stack enabled in grafana.

I have spend ages searching and so far cant find anything that will work for this.

is anyone able to assist with this?

Hi, I hope I can help you,

If I understand you well, you want to make a graph per month with the account.

I recommend you keep in mind the following two things.

  1. the time filter, this is on the top right. It could be that you have a filter that does not include months before June.

  2. You could try the type of x-axes graph as a series