I am having trouble condensing down a spreadsheet into a single PI Datalink formula or AF Analytic that can be written back to a tag. It seems like some combination of event frames and/or AF analytics should accomplish my need, but I'm stumped
I need to average a tag over the last 365 days that a particular expression is evaluated as true . . . not the last 365 days filtering out when the expression was false, the last 365 days worth of when it was true.
So far I have it condensed to this (which also illustrates what I am trying to accomplish)
Solving for 'x' in 365=PITimeFilterVal("'tag1'>5",’x’,*,"days",0,\\server)
Then evaluating PIAdvCalcExpVal("IF ('tag1' > 5 THEN ('tag2') ELSE nooutput()",’x’,"*","average","time-weighted","compressed","10m",0,1,0,\\server)
How do I determine 'x' without using an entire spreadsheet, excel solver, or excel macros?