# Create a horizontal line with one Datapoint

Hey,
i’m calculating one data point within an rolling time span. I want to create a horizontal line based on this one data point. Do you know a possibility to achive this?
I’m using influx 1.8 and Grafana 7.5

My query looks like this:

Select sum(“tag2”)/(sum(“tag1”)+sum(“tag3”)+sum(“tag4”))
from
(
SELECT sum(“value_float”::float)/60/1000 as “tag1” FROM “Example” WHERE (“Generic_Name” = ‘datastream1’) AND time > now()-365d GROUP BY time(1h) fill(none)
),(
SELECT sum(“value_float”::float)/60/1000 as “tag3” FROM “Example” WHERE (“Generic_Name” = ‘datastream2’) AND time > now()-365d GROUP BY time(1h) fill(none)
),(
SELECT sum(“value_float”::float)/60/1000 as tag4 FROM “Example” WHERE (“Generic_Name” = ‘datastream3’) AND time > now()-365d GROUP BY time(1h) fill(none)
),(
SELECT sum(“value_int”::float) as “tag2” FROM “Example” WHERE (“Generic_Name” = ‘datastream4’) AND time > now()-365d GROUP BY time(1h) fill(none)
)
WHERE time > now()-365d GROUP BY time(1h) fill(previous)

Thank you in advance for your help

hello if you want a horizontal line you can add additional data source that has a constant value over the max time range.

That is not going to work for me. I want to calculate the horizontal line and the value is changing constantly. That is why i calculate one Datapoint (which is again: constantly changing it’s value).
Is there a way to get a line out of this single point?

no i mean not a signle point, a dualpoint

How i said: I CANNOT (!!!) produce two Datapoints because i calculate my Datapoint out of 4 datastreams. Please look at my query to see what i am doing. I have to use one Query like my query above.

@patse Did you manage to achieve your solution?

This topic was automatically closed after 365 days. New replies are no longer allowed.