# Calculate difference between value from different sensors (Different measurement)

**URL:** <https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881>\
**Category:** Grafana\
**Created:** [May 2, 2019, 10:43am UTC](https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881 "2019-05-02T10:43:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![digithermo](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/digithermo/32/6882_2.png) [@digithermo](https://community.grafana.com/u/digithermo)\
**Post date:** [May 2, 2019, 10:43am UTC](https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881/1 "2019-05-02T10:43:36Z")

</div>

Hello everyone,

We are monitoring temperatures through IoT sensor and we are using Graph panel to display them. The data are streamed from InfluxDB every 15 minutes with different timing.  
I am wondering if it’s possible to calculate and display directly in Grafana the difference between two temperature/value. The values come from a different measurement.

For instance.  
The print screen attached shows the temperature form the Supply air vent and the Return Air vent.  
Any chance to display the delta T value = Supply Air temp - Return Air temp?  
The value doesn’t have to be displayed on the Graph. It can be displayed on a Singlestat panel.

Thanks!

 ![Temperature%20value%20difference](https://us1.discourse-cdn.com/grafana/original/2X/c/c5217f5b9ead2f19558e559b1fceed09922e91d6.png)

---

<div class="post-metadata">

**Author:** ![clanlaw](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@clanlaw](https://community.grafana.com/u/clanlaw)\
**Post date:** [May 2, 2019, 12:53pm UTC](https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881/2 "2019-05-02T12:53:07Z")

</div>

If the two values are from the same measurement you can subtract them in the query. toggle the display into the mode where it shows the query and use something like

```auto
SELECT "fieldA" - "fieldB" AS "whatever" FROM ...

```

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [May 2, 2019, 1:33pm UTC](https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881/3 "2019-05-02T13:33:27Z")

</div>

you can also use:

> **[MetaQueries plugin for Grafana | Grafana Labs](https://grafana.com/grafana/plugins/goshposh-metaqueries-datasource/)**
>
> Meta Queries Plugin for Grafana: Meta Queries plugin is built as a data source plugin and can be used in conjunction with other data source to show computed metrics like Moving Average, Time Shift.
> Installation Need to clone this repo into your...

---

<div class="post-metadata">

**Author:** ![digithermo](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/digithermo/32/6882_2.png) [@digithermo](https://community.grafana.com/u/digithermo)\
**Post date:** [May 2, 2019, 2:32pm UTC](https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881/4 "2019-05-02T14:32:45Z")

</div>

Thanks, I came across this solution on the forum. In our case the values come form different measurements.

---

<div class="post-metadata">

**Author:** ![danielwilliams](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@danielwilliams](https://community.grafana.com/u/danielwilliams)\
**Post date:** [May 7, 2021, 5:07pm UTC](https://community.grafana.com/t/calculate-difference-between-value-from-different-sensors-different-measurement/16881/5 "2021-05-07T17:07:00Z")

</div>

Hi, What was the your solution to this? I’ve attempted using **expr** which has failed when calculating a value between two different measures.
