The wheel fits the frame, but the disc rotor is not in the exact same place as your other wheel. You need to adjust the brake caliper to match the rotor location on the new wheel. Loosen the two bolts that hold the brake caliper to the frame and you will see that it can move sideways. If you want to be able to use both wheels, you will probably want to use shims on the rotor to move it over and match the old wheel.
If you were missing an endcap, it would be more than a few mm short.