A bond may have more than one yield measure such as yield to maturity and yield to call. A callable bond may have more than one call date. The yield to worst is the lowest of all these numbers.
In order to calculate the yield to worst it is necessary to calculate all yields to different call dates as well as the YTM.