I am using Grafana v10.0.3 with InfluxDB 1.8 and I would like to split up an energy meter kWh field, which has positive and negative values (import/export), in two separate fields (one for positive values, the other one for negative ones) that I can show the sum of all imported and all exported energy.
The total field is calculated by the sum of multiple import and export meters.
I thought it might work to make the field twice (total_pos and total_neg) and just filter it then, but it looks the calulcated values (min, max, average, total) don’t care about the filter.
Is this the way how it should be?
So far as I understand is this not possible, because the total which I calculate depends on the sum of all meter (Z).
For this reason was it my idea to duplicate the total into total_negativ and total_positive and filter these values then somehow, ether in the expression or after it.
This is how the energy meters (Z) are connected to each others and I want to calulate its total within 15 minutes.
Z = energy meters (separate positive/negative kWh counters)
G = generator which represents the energy producer (which is actually a photovoltaic inverter)
M = motor which represents the energy consumers.
Each meter accumulates positive as well as negative values, but within 15 minutes all positive and negative values compensate each other and I want to show that in the total calculation which works so far, since I just have to make the drawn values negative and build then a sum of all meters.
This sum I want to split up in a positive and negative field that I can create a min,max, average and total calculation from the drawn as well as delivered energy.
Since I am not able to upload .txt or .csv files here, I just renamed the .csv files to .json files.
I did export this data by the software ioBroker which is also recording the data (not sure how else I could get the data), hope this is the data for wich are you looking for.
DLV = delivery (positive values)
DRW = draw (negative values)
All these are kWh counters which increase all the time and for that reason spread() is used to get the consumed/delivered kWh in a certain time frame.
In my example, the transform looks like it is only using positive or negative values in the legend calculations. Are you able to use the Panel>More>Get Help option to share a copy of your panel with randomized data that we can look at? I’m wondering if it’s specific to the datasource, visualization, or if there is some other dashboard setting that’s causing the result you’re seeing. Have you tried creating this panel from scratch in a new dashboard?
> show series from actual
> show field keys from actual
> select * from actual where time > now() - 15s
time consumed phase produced
---- -------- ----- --------
1691133995509944118 0.109 1
1691133995509944118 3 0.788
1691133995509944118 0.268 2
1691134005534068594 3 0.75
1691134005534068594 0.262 2
1691134005534068594 0.109 1