How to add and subtract the same measured vale using IF function in the relevant

To preserve the quality of the measurements, we will calibrate the weight measurement every day. In this regard, if the measured value is more than the real value, it must be subtracted, and less than it must be added in commcare. How can I provide both an add and a subtract the value in the same relevant?

It might be easier if your correction can be a negative number. Then you could always subtract the measured value from the real value to obtain the correction, and always add it to other measurements to adjust them. For example:

real_weight: 100, measured_weight: 98 -> correction: 2
real_weight: 100, measured_weight: 101 -> correction: -1

If that's not quite what you mean, could you provide an example or write out what you want to do in pseudocode?

Thank you @Ethan_Soergel for the replay, it's working now.