NEED HELP Creating a Performance Equation that takes any scanned value over a specific number and subtract it by the setpoint value to find the variance.

So, I currently have a tag that records every single value from a weight scale but the weight scale kick-off the product once it gets to a specific range of weight. That value is not constant and varies widely. I want a performance value that records the value at the max before the scale numbers reset and subtract that value by the setpoint number (which is another tag, since it changes according to the product running) and get the variance value.