  We give a graded version of the M\"obius inversion formula in the framework
of trace monoids. The formula is based on a graded version of the M\"obius
transform, related to the notion of height deriving from the Cartier-Foata
normal form of the elements of a trace monoid.
  Using the notion of Bernoulli measures on the boundary of a trace monoid
developped recently, we study a probabilistic interpretation of the graded
inversion formula. We introduce M\"obius harmonic functions for trace monoids
and obtain an integral representation formula for them, analogous to the
Poisson formula for harmonic functions associated to random walks on trees.
