  We prove that for the dyadic maximal operator $\mathrm M$ and every locally
integrable function $f\in L^1_{\mathrm{loc}}(\mathbb R^d)$ with bounded
variation, also $\mathrm M f$ is locally integrable and
$\mathop{\mathrm{var}}\mathrm M f\leq C_d\mathop{\mathrm{var}} f$ for any
dimension $d\geq1$. It means that if $f\in L^1_{\mathrm{loc}}(\mathbb R^d)$ is
a function whose gradient is a finite measure then so is $\nabla \mathrm M f$
and $\|\nabla \mathrm M f\|_{L^1(\mathbb R^d)}\leq C_d\|\nabla f\|_{L^1(\mathbb
R^d)}$.
  We also prove this for the local dyadic maximal operator.
