Clever way to get pointvalues average disregarding 0's
-
I am looking for a simple method to calculate the average of a point-value array ignoring values that are 0's?
Is there anyway to use the statistics object with an array filter?
{{ ArrayValues | filter:{value: 0} }} -
@phillip-weeks said in Clever way to get pointvalues average disregarding 0's:
Is there anyway to use the statistics object with an array filter?
No. The statistics are calculated on the backend from a datapoint's values.
Your options are:
- Filter out the values and calculate the stats yourself on the frontend
- Create a meta datapoint which discards the zeros and run the statistics against that point
This thread is particularly pertinent -
https://forum.infiniteautomation.com/topic/4019/calculating-values-on-the-fly -
Thanks Jared I will create a new metapoint. :)