Custom Aggregates in a Matrix

The order, top to bottom, of the matrix's row groups should be the same as in the matrix's Properties dialog (the Groups) tab.

=Iif(
	NOT(InScope("SubCodeRowGroup"))
	, "A"
	, Iif(
		NOT(InScope("ProductGroupDescripRowGroup"))
		, "B"
		, Sum(Fields!Inventory.Value)
		)
	)