Hello,
I have a bucket namned Metrics, in this bucket i have two measurements, Electrical and Prices.
The Electrical measurement consists of different electrical columns and the Prices concists of hourly prices.
I am very new to Flux and find it a bit hard, i have tried to get this working.
Solution: Taking the different between the value on the act_pow_pos (increasing integer value) during 1 hour and multiplying that with the current hourly price
Code looks like following, i get the values, but i dont figure out how to calculate it.
union(tables: [
from(bucket: “Metrics”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “Electrical”)
|> filter(fn: (r) => r[“_field”] == “act_energy_pos”)
|> aggregateWindow(every: 1h, fn: first, createEmpty: false)
|> difference(),
from(bucket: “Metrics”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “Prices”)
|> filter(fn: (r) => r[“_field”] == “Price”)
|> aggregateWindow(every: 1h, fn: first, createEmpty: false)
]
)
|> sort(columns: [“_time”], desc: false)
|> aggregateWindow(every: 1h, fn: first, createEmpty: false)
Best regards.
Martin