chalk (something) up to experience
To regard a bad situation, action, or outcome as a learning experience rather than dwelling on its negative impact. I know you're upset about failing your exam, but just chalk it up to experience and try harder next time!