# system.historian.queryAggregatedPoints() per hour average?

**URL:** <https://forum.inductiveautomation.com/t/system-historian-queryaggregatedpoints-per-hour-average/111179>\
**Category:** Ignition\
**Tags:** ignition83\
**Created:** [October 3, 2025, 5:45pm UTC](https://forum.inductiveautomation.com/t/system-historian-queryaggregatedpoints-per-hour-average/111179 "2025-10-03T17:45:59Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Kurt.Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kurt.larson/32/6426_2.png) [@Kurt.Larson](https://forum.inductiveautomation.com/u/Kurt.Larson)\
**Post date:** [October 6, 2025, 6:15pm UTC](https://forum.inductiveautomation.com/t/system-historian-queryaggregatedpoints-per-hour-average/111179/3 "2025-10-06T18:15:07Z")

</div>

Here's an example. You'll need to calculate the hour intervals needed:

```python
import math 

end_date = system.date.now()
start_date = system.date.addDays(end_date, -1)

difference_in_seconds = system.date.secondsBetween(start_date, end_date)
total_hours = difference_in_seconds / 3600.0

hour_windows = math.ceil(total_hours)

paths = ['histprov:Historian:/prov:default:/tag:Ramp/Ramp0']
aggregates = ['Average']

result = system.historian.queryAggregatedPoints(paths=paths, startTime=start_date, endTime=end_date, aggregates=aggregates, returnSize=hour_windows)
for r in result: print r[0], r[1]
```

---

_[View the full topic](https://forum.inductiveautomation.com/t/system-historian-queryaggregatedpoints-per-hour-average/111179)._
