You don't have to use count or sum. Just take ProductID as Dimension and UnitsInStock as Expression like this ( =UnitsInStock ) in Bar chart. It will automatically show you the no. of units in stock per product id.
I think that approach is fine as long as there is just one record for each ProductID. However, if ProductID is duplicated in anyway (for example an additional field per record shows StockLocation) then this will show no value/Null value. Its best to use Sum which works in both cases.