# Historical tag average

**URL:** <https://forum.inductiveautomation.com/t/historical-tag-average/39876>\
**Category:** Ignition\
**Created:** [October 21, 2020, 4:59pm UTC](https://forum.inductiveautomation.com/t/historical-tag-average/39876 "2020-10-21T16:59:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [October 21, 2020, 4:59pm UTC](https://forum.inductiveautomation.com/t/historical-tag-average/39876/1 "2020-10-21T16:59:54Z")

</div>

hello  
Is there any way to show the average (or other calculation) of a range historical data on a display, as shown in the following screenshot ?

thanks you!!  
 ![Sin título](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/66e90619dd804755c356109afb2212405318e90b.png)

---

<div class="post-metadata">

**Author:** ![john.glynn](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/john.glynn/32/17348_2.png) [@john.glynn](https://forum.inductiveautomation.com/u/john.glynn)\
**Post date:** [October 21, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/historical-tag-average/39876/2 "2020-10-21T17:09:47Z")

</div>

Ta-da …err ¡Ya está!

[https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagHistory](https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagHistory)

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [October 22, 2020, 9:04am UTC](https://forum.inductiveautomation.com/t/historical-tag-average/39876/3 "2020-10-22T09:04:49Z")

</div>

is there any way to put that function in the numeric label value ?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 22, 2020, 1:19pm UTC](https://forum.inductiveautomation.com/t/historical-tag-average/39876/4 "2020-10-22T13:19:44Z")

</div>

In this instance I think you may actually want [system.tag.queryTagCalculations](https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagCalculations).

Either way the functions return a dataset, you can get the desired value from the dataset and put it into the label from what ever script you choose.

Something like this (assuming Vision):

```auto
if event.propertyName == 'some property':
	tagCalcs = system.tag.queryTagCalculations(paths = ['Your Tag Path'],calculations = ['Average'],rangeHours = 24)
	event.source.parent.parent.getComponent('Numeric Label').value = tagCalcs.getValueAt(0,0)

```

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [October 23, 2020, 11:02am UTC](https://forum.inductiveautomation.com/t/historical-tag-average/39876/5 "2020-10-23T11:02:13Z")

</div>

thanks you
