Why it failed
Staining on a ceiling means water: a roof, a failed shower pan above, or an air handler pan that overflowed. Soft, crumbling board low on a wall means the slab or an exterior wall is passing moisture. Cracks radiating from a door or window corner are usually settlement and are cosmetic. Cracks that reopen after repair are not.
Replacing board without finding the source guarantees you do it twice, and the second time includes the paint you just paid for.
When drywall repair means replacement
When the board has been wet. Gypsum that has taken water loses its strength and does not recover on drying, and paper facing that has been damp is a growth surface, which the EPA is clear about. Cutting back to sound material and replacing is cheaper than doing it twice, and the cut line should be set by a moisture meter rather than by where the stain stops.
Matching the finish
The hard part of a patch is not the board, it is making the repair disappear into the surrounding texture. Knockdown especially: matching the existing pattern and spray density takes practice, and a patch that is technically sound but visibly different is still a failed repair.