Please could someone help me im tring to convert a Query from QL to flux and cant seem to get it right
it is for it is taking a value and calculating to differance every hour to put in a bar graph.
thank in advance Tommy
Please could someone help me im tring to convert a Query from QL to flux and cant seem to get it right
thank in advance Tommy
Have you tried building the Flux query in Influx Data Explorer? I usually have good success there and then copy/paste the query to Grafana.
Hi grant, yes ive done that in the notebook but i just cant seem to make the numbers match to to old QL
from(bucket: “LawtonYarns”) |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == “EM3_Electrical_Workshop”)
|> filter(fn: (r) => r["_field"] == “Total_Power1”)
|>difference(nonNegative: false, columns: ["_value"])
|> aggregateWindow(every:1h, fn: last, createEmpty: false)
When you build the above Flux query in Influx Data Explorer, do you see any output on the graph?
dummy example:
What about in Influx Data Explorer? The URL would be http://<<your server>>:8086
That is where I will often build and test the query before trying it in Grafana.
another quick question how do i give the data an alias like in QL ?
You can use a Transformation to rename the data to something else. If you do not know how, search the forum with my name and the word transformation and influx and it should show up someplace.
This might be a useful resource in the future: TL;DR InfluxDB Tech Tips: Converting InfluxQL Queries to Flux Queries