Ad Widget

Collapse

Average Calculation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rickhl
    Junior Member
    • Aug 2015
    • 1

    #1

    Average Calculation

    I would like some assistance in calculating an average for an item and using the data in a trigger.

    The average I need it the average of the values only during business hours. The values vary too much between business hours and non business hours to be useful.

    Something like "average of all values from last Monday to Friday during 9:00 to 18:00"

    Please let me know if this can be done.

    Thanks.
  • jamesNJ
    Senior Member
    • Jun 2015
    • 103

    #2
    The easy answer would be to limit your item to a flexible interval which is limited to the time you desire. The trigger is simple then, it will only fire when the item is updated during the flexible interval.

    If you require to collect values all day but limit triggers to specific hours, the trigger expression will need to be looked at. I have't tried this yet (I use flexible intervals) but you could possibly use the .time function to bracket the time you are looking for. thinking our loud, something like:
    {host:item.key[].avg(3600)}>0 and ({host:item.key[].time} > 180000 or {host:item.key[].time} < 060000)

    The thought being is to look for an average over the last 1 hour, but the trigger is only true if the time is greater than 6pm or less than 6am.



    I haven't really tried the .time function, so it would be helpful if you can confirm that an approach like this works or not.

    Comment

    Working...