# How to calculate availabity using tag values

**URL:** <https://forum.inductiveautomation.com/t/how-to-calculate-availabity-using-tag-values/82769>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [December 6, 2023, 9:35am UTC](https://forum.inductiveautomation.com/t/how-to-calculate-availabity-using-tag-values/82769 "2023-12-06T09:35:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [December 6, 2023, 9:35am UTC](https://forum.inductiveautomation.com/t/how-to-calculate-availabity-using-tag-values/82769/1 "2023-12-06T09:35:40Z")

</div>

I want to calculate availability.  
Actual formula i am using is,actual hour/planned runtime. here planned runtime is memory tag.  
for actual hour, i am using  
machine\_up\_status- machine\_down\_status.  
I want to find time between machine\_up\_status and machine\_down\_status.  
here are questions:  
how to find that time between two tag.  
 ![Screenshot 2023-12-06 150626ig](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/f/5fa540e73673505eed13aaddb3ad43233202a377.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 6, 2023, 9:58am UTC](https://forum.inductiveautomation.com/t/how-to-calculate-availabity-using-tag-values/82769/2 "2023-12-06T09:58:30Z")

</div>

Your question is very unclear. Please edit (click the pencil icon) to fix.

- Use a capital letter at the start of each sentence. It helps to make it clear where the sentence starts.
- You mention `machine_up_status` and `machine_down_status` but you do not have tags with those names.
- You mention `actual hour` but don't explain what this is and there is no tag.
- What is `machine_up_status - machine_down_status` supposed to tell you? Are these supposed to be the time the machine was running / not running in the past hour? Note that if the machine ran for 30 minutes and stopped for 30 minutes that this expression will give a result of zero.
- Mark code, expressions or variables by enclosing them in backticks. e.g. `variable name` will render as `variable name`.
