Let be a (commutative cancellative) monoid. A nonunit element is called almost primary if for all , implies that there exists such that or . We introduce a new monoid invariant, diversity, which generalizes this almost primary property. This invariant is developed and contextualized with other monoid invariants. It naturally leads to two additional properties (homogeneity and strong homogeneity) that measure how far an almost primary element is from being primary. Finally, as an application...