  We study the distance on the Bruhat-Tits building of the group
$\mathrm{SL}_d(\mathbb{Q}_p)$ (and its other combinatorial properties). Coding
its vertices by certain matrix representatives, we introduce a way how to build
formulas with combinatorial meanings. In Theorem 1, we give an explicit formula
for the graph distance $\delta(\alpha,\beta)$ of two vertices $\alpha$ and
$\beta$ (without having to specify their common apartment).Our main result,
Theorem 2, then extends the distance formula to a formula for the smallest
total distance of a vertex from a given finite set of vertices. In the appendix
we consider the case of $\mathrm{SL}_2(\mathbb{Q}_p)$ and give a formula for
the number of edges shared by two given apartments.
