Update calculateShift to respect the maximum upper bound as well as the minimum value. Issue: SPR-11720