  We describe a generalization of Milnor's formula for the Milnor number of an
isolated hypersurface singularity to the case of a function $f$ whose
restriction $f|(X,0)$ to an arbitrarily singular reduced complex analytic space
$(X,0) \subset (\mathbb C^n,0)$ has an isolated singularity in the stratified
sense. The corresponding analogue of the Milnor number, $\mu_f(\alpha;X,0)$, is
the number of Morse critical points in a stratum $\mathscr S_\alpha$ of $(X,0)$
in a morsification of $f|(X,0)$. Our formula expresses $\mu_f(\alpha;X,0)$ as a
homological index based on the derived geometry of the Nash modification of the
closure of the stratum $\mathscr S_\alpha$. While most of the topological
aspects in this setup were already understood, our considerations provide the
corresponding analytic counterpart. We also describe how to compute the numbers
$\mu_f(\alpha;X,0)$ by means of our formula in the case where the closure
$\overline{ \mathscr S_\alpha} \subset X$ of the stratum in question is a
hypersurface.
