Investors & landlords

yes.  A $50K capital gain can be offset by say a $30K nonpassive loss from your sole proprietorship. net $20K  Not all ordinary losses can offset since there are special rules as to the deductibility of passive and other losses.