I have a RANGE PE - if Range('Tag1','*-30m','*') then 1 else 0, how can I count how many times this was true for specific # of days (lets say30)?
Please let us understand your question first:
- The result of Range() function is not boolean... Do You mean ex. "If Range('tag1','*-30m','*')>0 then 1 else 0" ? ("Has 'tag1' changed value in the last half an hour?"), or something similar?? In this case it makes no difference if 'tag1' is digital or analog.
You can count special events easily with PI-Datalink using Calculated Data function with basis 'event-weighted' and calculation mode 'count' with your desired condition as filter expression.
Or can be configured as a totalizer tag with similar logic.
(Or counting can be realized as PE tags with recursive calculations in more complicated ways.)
I hope it gives You ideas! What is Your intent?
As Janos mentioned, please give us a bit of context as to what you are trying to calculate/monitor.
Expanding on what Janos said, you could also use Asset Analytics to do the calculation.
OSIsoft: How to Setup Expression Analyses with PI AF [PI AF 2014- v188.8.131.5243] - YouTube
Retrieving data ...