When you add a product as a dynamic relation, you can specify the amount. i.e as is shown in this example, there are a certain amount of grams of product X in product Y.
I don't quite understand where the unit of the relation is defined. I can specify an amount in the relation, but where should it be defined that the amount is "grams"