You should replace the water filter as soon as your coffee machine prompts you to do so, but no less frequently than once every 2 months.
IMPORTANT: if you haven’t used your coffee machine at all for two weeks or more, you should replace the water filter even if unprompted.