I have been asked to come up with an equation that will return a value from the previous two months. I've created a calculation called 'Monthly' that calculates the monthly average flow. I need to be able to return the monthly average for last month and the month before that separately. So, since its currently October, I need the monthly average for September and August.

I'm successfully returning the monthly average for last month by using PrevVal('Monthly',bom('*')) in PI Analytics and I'm not historizing it as a tag.

I've tried a few things but can't seem to return the monthly average flow for 2 months prior.

Any ideas?

Thanks

Hi Kim,

Thanks for posting on PI Square. Please give the following analysis syntax a try:

PrevVal('Monthly',bom(bom('*')-1))

This should work since bom('*')-1 would be the last day of the second month.

Let me know how it goes.

~Jesse