HELP. Calculation in Grafana with influx db 2.0


I don’t know if it is possible but i try to achieve the following:
I have 2 sums of the energy consumption of my heat pump in influx (warm water and heating) in MegaWattHours.

I’d like to create a table with following: 2 Rows: Heating, Warm Water, 12 Colums (Jan to Dec) with the calculated value per month (in kWh).

Can i achieve this in Grafana?

Thank you!

Welcome @jonasboetsch

Are you using Flux or InfluxQL? Can you share the queries you have which generate the 2 sums?

1 Like

Hello and thanks for the welcome :slight_smile:

I am using Flux.
I do not have an example for the use case since i do not know where to start.

My graph for displaying the SOC of my car is:

  |> range(start:-7d)
  |> filter(fn:(r) =>
   r.item == "Auto_SOC")
  |> map(fn: (r) => ({  r with name: r._item }))
  |> aggregateWindow(every: 1h, fn: mean)

thre item names for the heat pump power consuptions are:

I do not know how to make a table with 12 columns (representing the months), but it is probably possible with some further effort.

Here is a bar chart with data by month. In your case, the two colors would correspond to Warmwasser and Heizung. In my case, I am grouping by region (which is a tag in my data) and measurement (called “demand data”). I am not sure how you have structured your fields and tags, but you would probably do something similar if you are content with a bar chart with monthly values.

1 Like

That looks amazing! Even better than a table!
I will check it out tomorrow! Thank you!
Since i am pretty new to Flux - would it be possible to share your code?
I can only see a snippet from line 7 to 9.