Simple arithmetic

I am new to HA, transferring automation from another system. I have set up the integrations and am trying to start meaningful automations. I am trying to calculate water use by subtracting one counter that I have set up from another, to determine use. Can anyone give me a clue as to hoe to accomplish this?

I recommend you review the documentation for templating. It explains how Home Assistant employs the Jinja2 templating language to provide programming functionality.

For example, the following template subtracts the value of one counter entity from another.

{{ states('counter.first') | float(0) - states('counter.second') | float(0) }}

Thanks it give me a starting point