Hi,
I’m assuming your table is connected to a dataset which is responsible for fetching all the items.
You can get all the items with this dataset API: wix-dataset - Velo API Reference - Wix.com
Then, like you said, you can loop over the array of items, and sum the unit count.
You can look online how to go over an array of objects in JavaScript in order to sum one of the fields.
One example: javascript - Sum values of objects in array - Stack Overflow
Good luck!