# Obtain tag value 1 minute ago

**URL:** <https://forum.inductiveautomation.com/t/obtain-tag-value-1-minute-ago/65416>\
**Category:** Ignition\
**Tags:** ignition80, ignition81\
**Created:** [October 19, 2022, 6:26pm UTC](https://forum.inductiveautomation.com/t/obtain-tag-value-1-minute-ago/65416 "2022-10-19T18:26:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesus\_Perez](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Jesus\_Perez](https://forum.inductiveautomation.com/u/Jesus_Perez)\
**Post date:** [October 19, 2022, 6:26pm UTC](https://forum.inductiveautomation.com/t/obtain-tag-value-1-minute-ago/65416/1 "2022-10-19T18:26:25Z")

</div>

Hello i need to get the tag value 1 minute ago and sustract with the actual value, i am using the maker edition

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [October 19, 2022, 6:32pm UTC](https://forum.inductiveautomation.com/t/obtain-tag-value-1-minute-ago/65416/2 "2022-10-19T18:32:56Z")

</div>

Some questions:

- How often is the tag updating?
  - How often do you need to update your 1 minute ago difference?

- Are you tracking this tag with the historian?
- Do you want the value in a tag or just want to display it on a screen?

---

<div class="post-metadata">

**Author:** ![Jesus\_Perez](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Jesus\_Perez](https://forum.inductiveautomation.com/u/Jesus_Perez)\
**Post date:** [October 19, 2022, 6:38pm UTC](https://forum.inductiveautomation.com/t/obtain-tag-value-1-minute-ago/65416/3 "2022-10-19T18:38:00Z")

</div>

- How often is the tag updating?  
1 sec but it is so slow so it works for me 1 minute

- Are you tracking this tag with the historian?  
yes, i am already plotting the tag

- Do you want the value in a tag or just want to display it on a screen?  
i want the value to display and historan

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [October 19, 2022, 6:49pm UTC](https://forum.inductiveautomation.com/t/obtain-tag-value-1-minute-ago/65416/4 "2022-10-19T18:49:22Z")

</div>

The easiest thing to do might be to run a gateway timer script that does something like this.

```python
readPath = 'PATH_TO_INITIAL_TAG'
storagePath = 'PATH_TO_INTERMEDIATE_TAG'
differencePath = 'PATH_TO_TAG_DIFFERENCE'

currentValue, oldValue = system.tag.readBlocking([readPath,storagePath])
calculatedDifference = currentValue.value - oldValue.value
system.tag.writeBlocking([storagePath,differencePath],[currentValue.value,calculatedDifference])

```

This will work on whatever period you set the timer script to run. It will break down somewhat if the gateway is stopped for a period of time. It'll take the difference from just before the gateway was stopped to the time of the first run which won't be the same duration you've selected, possibly muddying your data.

Another option would be to try system.tag.queryTagHistory.
