# Calculate delta between values of two rows of table

**URL:** <https://forums.losant.com/t/calculate-delta-between-values-of-two-rows-of-table/606>\
**Category:** Help\
**Created:** [August 30, 2017, 7:23am UTC](https://forums.losant.com/t/calculate-delta-between-values-of-two-rows-of-table/606 "2017-08-30T07:23:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Holger\_Sta](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/holger_sta/32/445_2.png) [@Holger\_Sta](https://forums.losant.com/u/Holger_Sta)\
**Post date:** [August 30, 2017, 7:23am UTC](https://forums.losant.com/t/calculate-delta-between-values-of-two-rows-of-table/606/1 "2017-08-30T07:23:08Z")

</div>

I add every hour a value (total number of written data) to a table in Losant.

Now I want to display the delta between the two entries (last and before last) of the table.

Any help ?

Regards  
Holger

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [August 30, 2017, 2:21pm UTC](https://forums.losant.com/t/calculate-delta-between-values-of-two-rows-of-table/606/2 "2017-08-30T14:21:17Z")

</div>

Currently dashboards are centered around displaying device data. [Data Tables](https://docs.losant.com/data-tables/overview/) are a brand new additional to our platform and we’re still investigating the best ways to expose the ability to display data from those.

An interesting work-around for now could be to record the delta onto device state. You can setup a timer to trigger once an hour. The workflow could then retrieve the most recent two entries from the data table, calculate the delta, and record it on a device’s state. Once the value is on a device state, you can display it using any number of dashboard blocks.

---

<div class="post-metadata">

**Author:** ![Holger\_Sta](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/holger_sta/32/445_2.png) [@Holger\_Sta](https://forums.losant.com/u/Holger_Sta)\
**Post date:** [December 12, 2017, 12:17pm UTC](https://forums.losant.com/t/calculate-delta-between-values-of-two-rows-of-table/606/3 "2017-12-12T12:17:17Z")

</div>

Hello,

thanks for your suggestion.

I finally solved it this way:

I used “Storage GET” and “Storage SET” and calculated the difference in a MATH item.  
(Note: The “Storage GET” has to be connected to the data flow, despite it does not use the input)

The result could be sent to a device or table adn then used to trigger some events.

Thanks for the great tool. I really like losant
