# Calculate percent runtime

**URL:** <https://forum.inductiveautomation.com/t/calculate-percent-runtime/9311>\
**Category:** Ignition\
**Created:** [November 10, 2014, 7:54pm UTC](https://forum.inductiveautomation.com/t/calculate-percent-runtime/9311 "2014-11-10T19:54:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [November 10, 2014, 7:54pm UTC](https://forum.inductiveautomation.com/t/calculate-percent-runtime/9311/1 "2014-11-10T19:54:49Z")

</div>

Has anyone found a good way to calculate percent runtime? For example to calculate the percent time a boolean value was 1 vs 0. Not a true OEE calculation and not requiring schedules or any other considerations.

---

<div class="post-metadata">

**Author:** ![AE2S\_Sanden](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AE2S\_Sanden](https://forum.inductiveautomation.com/u/AE2S_Sanden)\
**Post date:** [November 11, 2014, 4:05pm UTC](https://forum.inductiveautomation.com/t/calculate-percent-runtime/9311/2 "2014-11-11T16:05:07Z")

</div>

You could use a transaction group to log the boolean value on a set interval depending on the resolution you needed. Create a SQL query tag to count the number of records in the table, create another SQL query tag to count the number of records where the value is 1, and create an expression tag to calculate the percent runtime. Combine these tags into a UDT if you’re going to do this more than once.

What is the time period that you wanted to know the % runtime for? You could set the transaction group to delete records older than 24 hours, so you would always have a % runtime for the previous 24 hours. Log the % runtime expression tag for a historical record.
