Flow Sensor: How to get quantity rather than rate

Actually you need to keep track of two measurements on rate based and one time based, if you need know the total amount of material that has flowed over time. One is the specific flow rate at any given time it's measured and the other measurement is the flow totalizer the integrates the flow rate over time. It's not as simple as it might first appear.

Total flow amount (a quantity) is equal to flow (a rate of flow) over a specified time span. The difficulty is if the flow rate can or does change rather then always being a fixed rate, hence the need to do a integration calculation and periodically reset the flow, as in total gallons per day, etc.

If flow rate is a constant then you just need to keep track of time passed from start and keep a running total quantity flowed sense start.