How to show hourly kWh*price accumulated per day?

Hi folks,
I’m a beginner with Grafana just spent some days in it but really like it so far.
I’m playing around with Node-Red, Influx 1.8 and Grafana 9.0.9 on my Raspberry Pi 3b
In my Influx:

  • measure holding the hourly usage in kWh
  • measure with the hourly price per kWh

In Grafana I’m fetching these measures into a chart.

To get the total cost I have to add another tax (+0.9963) and VAT (*1.25).
So far so good. Now I add a transformation to join the kWh and price together to get my cost per hour. This also works as a charm :slight_smile:

Now I would love to take the following steps:
1 Sum my cost per day
2 Sum my cost per month
3 Add the tax as a variable per month

  1. I cannot find a way to accumulate the cost I’ve created in the transform step per day. Any hints how that can be done?
  2. I have understood that Grafana is missing some date-functions so accumulating per month will be even harder since I couldn’t find a way just accumulating the kWh per month in a bar-chart.
  3. There are fees which changes once or twice per year. I would appreciate to have these stored in a table per month and not per hour. Any hints on how to proceed there? I’m thinking the answer will be to incorporate it in the price-measure when Node-Red writes to Influx is the way forward but would like your suggestions.

No hints at all out there?

@andreaskse Would you be willing to migrate from InfluxQL to Flux? This sort of thing (incl. using Node-RED to inject your values into InfluxDB) is very easy with Flux.

I’ve now looked into the Flux-language and must say it looks promising.
My problem is that I’m on a Raspberry Pi 3B with old Raspbian OS since I have a library in Node-Red (node-red-contrib-tellstick (node) - Node-RED) which I cannot get to work in newer versions. That is my next project :slight_smile:

My understanding is that Flux comes with Influx 2.0 and requires 64-bit OS, right?

My new approach is to add more data in the measurements and write some queries to aggregate per day at least.

I also added the month-name as a field and tried to create a bar-chart. It actually worked and gave the correct bars. Anyone knows a way to define the sorting or do I have to make sure the monthnames contains numbers in the beginning since they seems to be sorted by name?

I run InfluxDB v2.5 on Raspberry Pi Desktpop 32-bit. See more here.

I would recommend you make the jump from InfluxQL to Flux. Aggregating your data by calendar month or year has been fully supported in Flux since 2019.