Monthly average from 06:00. Might be simple but I´m getting lost. What to calculate the average from 06:00 the first day of each month to 06:00 the first day of next. Having trouble around midnight and getting strange values. Any smart ideas?

Parents Reply
  • That's a lot of logic, and it tells me your task isn't as simple as "calculate the average from 06:00 the first day of each month to 06:00 the first day of next". Because if it is, you can do this in one operation, as I demonstrated in the first reply. If not, please specify more in detail how you need the logic to work.

     

    Your screenshot doesn't show the scheduling, but the logic of comparing timestamps in "TotOut" indicates you may be scheduling this to run every six hours during the day? Or every hour perhaps?

     

    So exactly at 06:00 first day of the month you reset to 0, then you have the middle line which is run between 00:00 and 06:00, and the last line if the calculation runs after 06:00?

     

    Readability of the logic isn't that good, and especially being used to BOM() for beginning of month, I find the whole Yearday('1') syntax a bit confusing. Please explain the two TimeM and Time6h a bit more. Are they fractions of a month, and you multiply the averages by this fraction? Wouldn't it be better to just add the correct end time directly in the TagAvg functions?

Children
No Data