In case you're open to try a new tool, here is how you can do it in GeoPard https://docs.geopard.tech/geopard-tutorials/agronomy/field-trial-analytics Calculation could be based on as-applied or Rx.