# system.tag.queryTagHistory for 3 day / 3 hour segment average

**URL:** <https://forum.inductiveautomation.com/t/system-tag-querytaghistory-for-3-day-3-hour-segment-average/112977>\
**Category:** Ignition\
**Created:** [December 23, 2025, 8:02pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-for-3-day-3-hour-segment-average/112977 "2025-12-23T20:02:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bigtalljv](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@Bigtalljv](https://forum.inductiveautomation.com/u/Bigtalljv)\
**Post date:** [December 23, 2025, 8:02pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-for-3-day-3-hour-segment-average/112977/1 "2025-12-23T20:02:58Z")

</div>

hi,

I am trying to do some scripting, but I am totally out of my depth. I have a tag, [default]\_25\_FI\_110X\_Total, and I need to get the average of the last 3 days for just the first three hours of the day, 0000-0300.

I think this works for today 0000-0300 but I have no idea how to do multiple time periods to get data for all three days, if that can even be done. Do I need to do three separate functions and then average those three numbers?

here is what I have for today’s time period:

```python
    paths = ['[default]_25_FI_110X_Total']
    startDate = system.date.midnight(system.date.now())
    endDate = system.date.addHours(startDate, 3)
    dataSet=system.tag.queryTagHistory(paths=paths, startDate=startDate, endDate=endDate, aggregationMode = 'SimpleAverage', intervalMinutes = 1, returnFormat='Wide')
    return dataSet

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 23, 2025, 8:07pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-for-3-day-3-hour-segment-average/112977/2 "2025-12-23T20:07:20Z")

</div>

The historian doesn't support multiple time intervals in single calls. You will need a query per day.

---

<div class="post-metadata">

**Author:** ![Bigtalljv](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@Bigtalljv](https://forum.inductiveautomation.com/u/Bigtalljv)\
**Post date:** [December 23, 2025, 8:48pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-for-3-day-3-hour-segment-average/112977/3 "2025-12-23T20:48:26Z")

</div>

thank you
