[VERY NEWBIE ] Show difference between two graphs values

I have a graph showing 2 temperatures.
I would like to have a third one showing the difference between both.
i try several querys without success , any idea ?


are these values coming from the same measurement ? then it should be easy like

SELECT “fieldA” - “fieldB” AS “whatever” FROM …

If they are coming from different measurements it is not so easy but possible.
Please have a look then here at the last post --> L I N K

Thanks for yr reply.

Values are coming from same measurements ( name: chaudiere)
What did i try :
SELECT last("value") FROM "chaudiere" WHERE ("topic" = 'chaudiere_1/T.INTERNE/T.interne') - last("value") FROM "chaudiere" WHERE ("topic" = 'chaudiere_1/T.EXTERNE/T.ext') AND $timeFilter GROUP BY time($__interval) fill(previous)

error parsing query: found FROM, expected ; at line 1, char 108

With your answer it seems that i can get values from query B and C

Then i try something like :
SELECT “fieldB” - “fieldC” AS “TEST” FROM "chaudiere" AND $timeFilter GROUP BY time($__interval) fill(previous)

No help :frowning:

field B query :
SELECT last("value") FROM "chaudiere" WHERE ("topic" = 'chaudiere_1/T.INTERNE/T.interne') AND $timeFilter GROUP BY time($__interval) fill(previous)
field C query :
SELECT last(“value”) FROM “chaudiere” WHERE (“topic” = ‘chaudiere_1/T.EXTERNE/T.ext’) AND timeFilter GROUP BY time(__interval) fill(previous)

If you can help me with more detailed answer.
thanks again .

Don’t know excatly but maybe this helps:

SELECT mean("house_power")-mean("device_power") FROM "power" WHERE $timeFilter GROUP BY time($interval)

Maybe the documentation helps you also about function DIFFERENCE()


DIFFERENCE() is for the difference between field values, not between fields