Hello Tomas,
It looks to me that you have kind productlines in your datagrid2 and on your right handsside have a summary of your productlines per product:
What I think you can do is to make an after commit flow on your product lines that fetch or create a product summary object and sums the number of products, you can do this within a microflow and use the aggregate list sum function.
Depending on your domain model it is maybe already possible to retrieve all the productlines over association product otherwise you need to retrieve your lines by xpath based on the id make sure if you have a lot of lines that you put an index on the id then.
Hope this helps!
Good luck
Here an example:
Domain model simple:
After commit on ProductLine
ACO Microflow:
Sum action
Change ProductSummary:
Make also sure when you delete an entity that you set an event handler on deletion which basically would look the same as this example
Make sure that the product has a product summary entity for example with an FoC