A method, and milking system, for managing a herd of dairy animals including N groups, wherein N≥2, and the method includes: A) determining a content of a substance in the milk for a group of dairy animals, and B) performing an animal-related operation for the group, based on the content of the determined substance.