The most efficient way is to create an OQL-command for that. Download the OQL from Appstore, in your micrflow create an variable containing the OQL-command and execute the OQL command:
SELECT <yourmodule>.Buyer.Name,COUNT(*) as NumberOfTransactions FROM <yourmodule>.Transaction GROUP BY <yourmodule>.Buyer.Name
Make it return a list of Name, NumberOfTransactions.
if you are not comfortable with OQL, then do it in a microflow, but the other way around compared to your current microflow: loop over each Buyer and count the number of tranasctions. See this microflow:https://modelshare.mendix.com/models/f4aa2b3f-5cad-4d09-a5b9-6f70384ebaa2/su-b-employee-get-number-of-employees-per-oganization
A third way is to add a calculation-attribute to Buyer, call NumberOfTransactions an attach your calculation-microflow to it. Then you only have to read the Buyer’s attribute. Be careful not to have your app calculate it more then necessary.