A system for detecting an axial position of a threaded piston rod of a drug injection device, the system comprising: - a sensor assembly comprising one or more sensors each adapted to measure a magnetic field corresponding to three axes, a moveable element, - a magnet mounted to the moveable element and moving together therewith, the magnet configured to generate a spatial magnetic field which relative to the sensor assembly varies corresponding to both the axial and rotational movement of the magnet and thus the moveable element, thereby generating a spatial magnetic field which varies uniquely relative to each sensor, and - processor means configured to determine on the basis of measured values an axial position of the moveable element, characterized in that - each sensor is adapted to measure a magnetic field corresponding to three axes arranged perpendicularly relative to each other, - the moveable element such as said threaded piston rod being adapted to be moved relative to the sensor assembly by a combined axial and rotational movement corresponding to a pre-defined axis, the rotational movement having a pre-determined relationship to the axial movement, and - the processor means, on the basis of the measured values, is adapted to: - determine an initial axial position of the moveable element, - determine a rotational position of the moveable element, and - calculate a corrected axial position of the moveable element, wherein the calculation is based on the determined initial axial position, the determined rotational position, and the pre-determined relationship between the rotational and the axial movement. - a sensor assembly comprising one or more sensors each adapted to measure a magnetic field corresponding to three axes, a moveable element, - a magnet mounted to the moveable element and moving together therewith, the magnet configured to generate a spatial magnetic field which relative to the sensor assembly varies corresponding to both the axial and rotational movement of the magnet and thus the moveable element, thereby generating a spatial magnetic field which varies uniquely relative to each sensor, and - processor means configured to determine on the basis of measured values an axial position of the moveable element, characterized in that - each sensor is adapted to measure a magnetic field corresponding to three axes arranged perpendicularly relative to each other, - the moveable element such as said threaded piston rod being adapted to be moved relative to the sensor assembly by a combined axial and rotational movement corresponding to a pre-defined axis, the rotational movement having a pre-determined relationship to the axial movement, and - the processor means, on the basis of the measured values, is adapted to: - determine an initial axial position of the moveable element, - determine a rotational position of the moveable element, and - calculate a corrected axial position of the moveable element, wherein the calculation is based on the determined initial axial position, the determined rotational position, and the pre-determined relationship between the rotational and the axial movement. - determine an initial axial position of the moveable element, - determine a rotational position of the moveable element, and - calculate a corrected axial position of the moveable element,