I have been trying different formulas to track a tank level and determine what the 12 hour average usage of material is. The complication is that during a 12 hour period the plant will have to add to this tank to prevent the tank from going empty.

I am having trouble writing a formula in PIAF that will track the level and determine when that level increases so I can include that amount of increase in my formula.

I am doing this in PI AF so I would expect to be easier than doing it in a performance equation but I just can't figure out a good way to do it.

Here is a screenshot of the formula I am using, I repeat this 12 times then sum the values at the end.

Any input is appreciated.

Thank you,

dan