I am trying to use the Formula Data Reference to perform simple calculations, where the input variables are Table Lookup Data References that are configured to return time series data. My use case for this is to perform simple calculations on data with future timestamps. So far this has worked out well for me, and the output attribute returns a time series with future data as expected (when I request time ranges that extend into the future).

Now I want to include another input variable that refers to a PI Point Data Reference. The issue I am facing is that I want the Formula DR to only evaluate the most recent archived value for the PI Point DR, even when evaluating the Formula DR expression at future times. Essentially, I am trying to use the PrevVal function in the Formula DR, but this does not seem to be available.

Is there a solution that makes this possible? I have tried numerous things, including:

- Setting the value retrieval method for the PI Point DR to "Before" or "At or Before"
- Using an AF Analysis to output the result of PrevVal('Tag', '*') to an output attribute
- Routing the value of the PI Point DR to another attribute configured using the String Builder DR

However, none of these seem to be working. When the Formula DR evaluates this input at future timestamps, it gets back "No Data," which causes the entire Formula DR to fail. The only way I have found to prevent the Formula DR from failing is to use a BadVal check on the input variable and return a fixed default value, but this is not a viable solution for my particular use case.

Interested to hear your thoughts on this problem.

The Formula DR is intended to be used for standard math functions, and has extremely limited support for PI specific functions (only badval and digstate). Archive functions such as PrevVal, PrevEvent etc aren't supported by this data reference. If the options you listed and have tried so far aren't giving you the intended results, I would consider moving the entire calculation to an Expression Analysis where the required archive functions are natively supported, and you can wrap the entire logic and functionality of your calculation in a single configuration location. Otherwise you may end up spending a lot of time trying to find a second rate workaround with the Formula DR.