Transform number of produced units in on/off status

Hi all,

I pretty new to Grafana, so I apologise in advance, if my questions are pretty “basic”.

We are currently piloting Grafana (v7.1.0) linked to a InfluxDB as frontend to visualise our machine status.

I have a time series with # of produced units per minute.

I would like to transform this time series in a binary “on” / “off” time series, so show 0 (for “off”), if the # of produced units is 0. If the # of produced units is >=1 I would like to show 1 (for “on”).

I am not sure if transformations or overrides are the correct way to get it done or if I can already transform the data in the query from Influx.

I hope the question is clear and I am happy for any support.


Interesting question. I think there are a few possible approaches - with the options being along the lines of what you listed. It should possible to do this in the query itself; maybe not the “nicest” solution, but if you’re using InfluxQL, what comes to mind is something like

SELECT ceil(value/1000) FROM ...

If value is 0 this should return 0. If it’s between 1 and 1000, it should take value/1000 and round it up to the closest integer, which is 1.

Amazing! Sometimes it’s so “simple”… There is a big learning field ahead of me :wink:

Thanks for your help!

1 Like

Just out of interest, why are you starting out with a year-old version of

Current versions are 7.5.9 and 8.0.3

You’re more likely to get good help with questions here if you’re using a
recent version :slight_smile:


Fair point. We will upgrade to Grafana 8.x soon.

Just didn’t want to wait with my question and wanted make people aware just in case that it has any impact on the possible answers.