Hello, community -
I hope someone might be able to help me troubleshoot a conditional formula in an integer question's 'calculation' field. The field is inside a repeat and the formula's condition references the repeat record's position(..).
For context: I've developed a form where the user records different soil strata as they dig. The attributes of each of these strata (color, consistency, observations, etc.) are recorded in a ${SoilLevel} repeat. The user records the top and bottom depth of each of these strata (see below).

I'd like the form to fill in each level's Top Depth (${SoilTopDepth}) automatically with "0" for the first level (${LevelNumber}) and the previous level's Bottom Depth (${SoilBotDepth}) for all levels after that.
The formula I'm using in the ${SoilTopDepth} field's "Calculation" column isn't populating the field on the form:
if((position(..)=1), 0, (once(max(${SoilBotDepth}))))
For broader context, here's a screencap of the relevant section of the XLSForm:

Can someone point out what I might have wrong?
Also, I was curious if my calculation formula for the ${LevelNumber} field (once(count(${SoilLevel}))) might work better if it were replaced with position(..). Just curious about that one...
Thank you in advance!