Graphs for Month

Hi to all.
I’ve a table in this format:
datetime | energy
I’d like to create a graph that represents the energy by months, so in the x-axis
January, February, March, April, etc.
And for each month a serie for each year, showing the sum of energy for that month and that year, to compare the energy each month in all years.

I’m thinking it’s not possibile in grafana…
Thanks a lot.

A few simple questions - What database are you using? and is Grafana currently connected to the database with a working connection?

Grafana can group time series by any range of time using the Group By feature (depending on data source)

I’m using Mysql.
The group by feature works for tables, but not for graphs.
If I change db, changes the behavior of grafana? (sorry I’m learning grafana since few weeks…)
thanks.

Im using InfluxDB amd have the same problem. I have an energy counter data and want to get a monthly statistics, i.e. January power consumption = 01 Feb meter readings - 01 Jan meter readings, and so on. Still dont get how to do it

@angeroluca - Group By should work for graphs as well - can you put a csv of your table somewhere online? Ill see if I can create the graph sometime today.

@alexsmart - Can you go toggle the “Text Edit Mode” for the query and post it your query here?

The first you have to know is how you store your metrics and how to explore it.

I log a few power metrics once per second. Then I create some mean metrics like mean minute and hourly means

To show month and year metrics I use the hourly mean of each day.

Are you looking for something like this?

This month:

Previous month

This year

Previous year

Thanks, you can download the CSV (with the result I would) here: https://we.tl/t-bJYNb3xOsY
The columns are:
IDImd: ID record
IDImp: ID for the plant
DataOra: date/time of the record
Anno: year of datetime
Mese: month of datetime
Prodotta1: energy of that period

In the excel file I put the graph like I wold see in grafana, if possibile.
Thanks for your support.

Something like that.
Below the example with my data, grouped by month

But I need to group all months of many years in several bars, like that:

Thankyou

uhhh… I believe you just need to use order by if you are using SQL

SELECT     Prodotta1
FROM       YourTable
order by     Mese, Anno

Sorry but in this way I see only the table, without grouping…

Alright with a little tinkering this morning I was able to accomplish what you wanted -

First you need to download the multistat plugin located here

Next you need to add a column in your data that combines the month and the year, something like “MM-YYYY”

Then you can use the query -
select sum("usage") from test group by newColumn

then you set the label column to your newColumn and the value column to sum - and viola, you should have a graph that looks similar to this.

Great!!!
I used that plugin, a little different from your istructions but the result is the same!


Thank you a lot!!