Combining series with individual thresholds into one representative value

Hello everyone,

I am using Grafana 10.0.0

I am trying to make a representative value for multiple series, each with their own individual thresholds.

I have used the “Filter data by values” transform to specify the threshold limits of each series and this results in no data when the value goes out of the threshold limit. Then, I set the value to be shown as ‘0’ when there is no data to be shown.
I then used the ‘min’ reduce function as a collective representative value hoping that it would also take the ‘0’ into account when there is no data for a partiular series.

However, the ‘0’ value is not being taken into account and the min value from the remaining series with data is being calculated.

I didn’t receive any errors. It is just not working the way I want it to. I would like to know if I am doing something wrong or if there is any other way to acheive this.

At the end, I was thinking of replacing all the series with this representative value and map it to say ‘Needs attention’ if the min value reaches 0.

*DI3962 in the picture is the speed. It is showing 0 now because the value is outside the threshold limit. But, the min value is showing 24 (the next minimum value) instead of 0.

This is just visual representation at the end, it’s not 0 value on the transformation level - prove it by debugging a transformation (there is icon for that).

I would code that logic in the query:

if value>MIN and value<MAX then:
  value
else:
 0

Of course you must to write that logic in your datasource supported syntax/language.

Thank you for the response.
The problem with this is that, it is not a code, but a stored procedure.
Each of the query consists of only a line.

For the query with the reults for speed, the code is just
EXEC GY.db.Sc $__timeFrom(),$__timeTo(), 3962, 60

where
$__timeFrom(),$__timeTo() is the time interval
3962 is the parameter for the speed column
60 is the interval between each value in seconds. I cannot open up the stored procedure.

Quick google: sql - How to execute a stored procedure inside a select query - Stack Overflow

Thank you. Finally got it to work.