GROUP BY for Bar Charts

Hi all! I am trying to display the duration of all runs grouped by months, but when I try to use this qeury, the bars don’t have month number, it is only displayed in the legend.

I know that I can select the field I want to be shown as well, without using GROUP BY, but in this case I can’t use SUM() because Influx doesn’t support aggregated and non-aggregated functions togather.

My scheme:

fieldKey fieldType


duration integer
month string

tagKey

id
platform
project_name
tag_month
year

  • What Grafana version and what operating system are you using?
    9.4.2

  • What are you trying to achieve?
    I want to display duration of all runs for aech month.

  • How are you trying to achieve it?
    I am using GROUP BY and selecting two fileds togather. but this doesn’t work

  • What happened?
    4:00 is displayed under all bars

  • What did you expect to happen?
    I expect month to be displayed under each bar instead of “4:00”

  • Can you copy/paste the configuration(s) that you are having problems with?
    SELECT sum(“duration”) / 60 from “$project-testRun-duration” WHERE (“year” =~ /^$year$/) GROUP BY “tag_month”
    SELECT “duration” / 60, “month” from “$project-testRun-duration” WHERE (“year” =~ /^$year$/)

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

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