AnsweredAssumed Answered

Writing analysis result back to first day of previous month

Question asked by Cheerion Champion on Oct 26, 2017
Latest reply on Oct 27, 2017 by sraposo

Dear,

 

Daily values are manually written by a user into a PI-tag through 'the Excel and VBA combo'.

On every second Monday of the following month, I need to totalize these daily values. Therefore I'm running analysis which totalizes to daily values into a monthly value.

 

First issue that came up was how to handle the analysis being scheduled? I found an easy solution as I create a scheduling PI-tag. I putting in a '1' on each second Monday of the month.

My analysis is ran daily at midnight and the first thing I check in my totalizer is whether the value of the scheduling PI tag on trigger time is equal to '1', if not NoOutput(). Works fine so far...

 

Next request from my client is that the result of my analysis should be written back to the first day of the previous month. So to the first day of the month of which I totalized the daily values.

The second Monday in October is October 9th and values should be written back to September 1st. In November, the second Monday is November 13th and the values should be written back to October 1st.

As the second Monday of the month isn't always the same day, I'm not able to set the advanced scheduling on 'Relative to trigger time' as '* - 1mo - 9d' as will work for October but in November the result will be written back to October 4th.

 

Is there a solution for this? If not, could you think of a workaround?

Outcomes