  We study a version of the Lebesgue differentiation theorem in which the
integral averages are replaced with medians over Busemann--Feller
differentiation bases. Our main result gives several characterizations for the
differentiation property in terms of the corresponding median maximal function.
As an application, we study pointwise behaviour in Besov and Triebel--Lizorkin
spaces, where functions are not necessarily locally integrable. Most of our
results apply also for functions defined on metric measure spaces.
