# Simplest Way To Count Total Times A Tag Alarms

**URL:** <https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 25, 2025, 4:00am UTC](https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746 "2025-06-25T04:00:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [June 25, 2025, 4:00am UTC](https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746/1 "2025-06-25T04:00:36Z")

</div>

As the title suggests. What is a way I can count the amount of times a tag alarms

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 25, 2025, 4:06am UTC](https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746/2 "2025-06-25T04:06:45Z")

</div>

Querying the alarm history table will be your best option

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [June 25, 2025, 4:35am UTC](https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746/3 "2025-06-25T04:35:51Z")

</div>

I tried:

SELECT COUNT(\*) AS alarmCount  
FROM alarm\_events  
WHERE source = 'path/to/your/alarm'  
AND eventtype = 0 -- 0 = Active

But get 0 returning which is wrong since one of the tags I try with is currently alarmed

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 25, 2025, 4:43am UTC](https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746/4 "2025-06-25T04:43:16Z")

</div>

> [@scadafan](#):
>
> WHERE source = 'path/to/your/alarm'

`source` is a qualified path like "prov:default:/tag:path/to/your/alarm"

You can either get the exact source which will make the query faster, or you can use LIKE

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [June 25, 2025, 5:16am UTC](https://forum.inductiveautomation.com/t/simplest-way-to-count-total-times-a-tag-alarms/107746/5 "2025-06-25T05:16:06Z")

</div>

Ah yes that could be why. I will give it a try tomorrow and let you know my findings. Thank you for your insights
