In case anyone else needs a solution to this, enter the below code into the Position property of your keyframed object.
Many thanks to the brain of Filip Vandueren who came up
with this solution.
t1= key(1).time;
t2= key(numKeys).time;
x1=key(1).value[0];
x2=key(numKeys).value[0];
linear_x=linear(time, t1, t2, x1, x2);
precision = 3; // make this higher (16) if you need Motion blur
fd = thisComp.frameDuration/precision;
y=key(1).value[1];
for (t=t1; !(t>t2); t+=fd) {
v=valueAtTime(t);
if (v[0]>=linear_x) {
y=v[1];
break;
}
}
[linear_x,y];