influxdata / influxdata/influxdb

Unable to add two fields together

Open
#24,328 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

from(bucket: "mybucket")
|> range(start: 2023-07-25T00:00:00Z, stop: 2023-07-26T00:00:00Z)
|> filter(fn: (r) => r._field == "Power(W)" or r._field == "system_production")
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> map(fn: (r) => ({
_time: r._time,
system_production: int(v: r["system_production"]),
total_solar_generation: int(v: r["Power(W)"]) + int(v: r["system_production"])
}))

I have two solar inverters. One shows generation as "system production" and the other shows as "power". I'm trying to add these two together to create a new value called "total solar generation" - every time i run this or slight variations, i end up with Null in the data explorer. please help!!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied Flux query in the InfluxDB Data Explorer, focusing on the pivot and map steps that produce null values. No repository file or test is identified; done would mean determining why the two fields cannot be combined and documenting or implementing a confirmed fix.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.