Color of Stat panel based on other value/measurement

Hi

Is it possible to display a value on a Stat panel and base the color of it on another value?
More specific:

I would like to display the temperature of two rooms and when the temperature between those two rooms is more then 5°C both stat panels should become red.

All data is stored in a InfluxDB v1.8.
Grafana version is v8.3.3

It is fairly easy to color them based on threshold (from their own value), but not based on a difference between two values, like what I found.

Does someone have a clue?

Thank you!

Kind Regards

Pieter-Jan

What is your datasource?

I’m sorry, is added to the original post.

I assume you are using InfluxQL (not Flux). Very basic approach like this should work:

query A: Room1Temperature
query B: Room2Temperature
query C (use the pencil icon and write the query):
SELECT mean(“Room1Temperature”) - mean(“Room2Temperature”) AS “RoomTemperatureDIFF” FROM “stations” WHERE $timeFilter GROUP BY time($__interval) fill(null)

Thank you for your answer.
Okay, so then I have all values in one panel, but how can I then display the value for Room1Temperature on the panel and color it red when when RoomTemperatureDIFF is greater then 5?

Do the 3 queries, but click the eye icon
image
to disable queries A and B. Query C should still work.

The create the stat panel to display the value in Query C. Change your thresholds and colors as appropriate. The stat panel color should reflect the RoomTemperatureDIFF value and your thresholds. Make sense?

Yes, indeed, make sense, for displaying the value of query C.
But I want display the value of query A (or query B) and use query C for the color of the thresholds.

Is this possible?