# Calculating value between 2 points

**URL:** <https://community.influxdata.com/t/calculating-value-between-2-points/29757>\
**Category:** Systems\
**Created:** [May 3, 2023, 6:32am UTC](https://community.influxdata.com/t/calculating-value-between-2-points/29757 "2023-05-03T06:32:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_B](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/j_b/32/13340_2.png) [@J\_B](https://community.influxdata.com/u/J_B)\
**Post date:** [May 3, 2023, 6:32am UTC](https://community.influxdata.com/t/calculating-value-between-2-points/29757/1 "2023-05-03T06:32:41Z")

</div>

Hi all,  
I am collecting my Data from my heatpump with influxdb. The issue I am facing, I do not get the actual vaule how much energy my heatpump is consuming. The only value I am getting is the total value the heatpump consumed. So my idea now is to create a new measure wich calculate the difference between these to points and write this as a new measure.  
As an example:  
Timestamp value  
8:58 10000  
9:00 11000  
9:02 11500

out if this I want to get the new measure like:  
Timestamp value  
8:59 1000  
9:01 500

and so on.  
Any Idea how I can do this?

---

<div class="post-metadata">

**Author:** ![grant1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/grant1/32/15107_2.png) [@grant1](https://community.influxdata.com/u/grant1)\
**Post date:** [May 3, 2023, 9:50am UTC](https://community.influxdata.com/t/calculating-value-between-2-points/29757/2 "2023-05-03T09:50:04Z")

</div>

Welcome @J_B

Assuming you are using Flux, have you tried the [difference() function](https://docs.influxdata.com/flux/v0.x/stdlib/universe/difference/)?

---

<div class="post-metadata">

**Author:** ![J\_B](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/j_b/32/13340_2.png) [@J\_B](https://community.influxdata.com/u/J_B)\
**Post date:** [May 3, 2023, 12:45pm UTC](https://community.influxdata.com/t/calculating-value-between-2-points/29757/3 "2023-05-03T12:45:21Z")

</div>

Hi grant1,  
thanks a lot for your reply. at moment I only have installed influxdb, so I guess flux is something like pgadmin for PostgreSQL?  
at moment I simply put the command influx in the shell and then i can run queries like show measurements.  
So I guess I have to add flux and then continue with difference()?

---

<div class="post-metadata">

**Author:** ![grant1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/grant1/32/15107_2.png) [@grant1](https://community.influxdata.com/u/grant1)\
**Post date:** [May 3, 2023, 10:05pm UTC](https://community.influxdata.com/t/calculating-value-between-2-points/29757/4 "2023-05-03T22:05:02Z")

</div>

Which version of InfluxDB are you using? They have several products, and each uses different querying languages (InfluxQL, [Flux](https://docs.influxdata.com/influxdb/cloud/query-data/get-started/) and now SQL).

From your description, it sounds like you may be using InfluxQL. Maybe [this](https://stackoverflow.com/questions/52566289/using-influxdb-difference-function) will help you get started?
