By using Group by on your enumeration-attribute.
See button “count(o.TotalPrice), sum(o.TotalPrice), and group by enumeration” on the OQL playground. Check out the “group by c.CustomerType”, which is an enumeration-attribute.
Or manually copy-paste this OQL into the edit box and click execute:
select c.CustomerType, count(o.TotalPrice) Ordercount, sum(o.TotalPrice) TotalSpent
from "Sales.Customer" c
join "c/Sales.Order_Customer/Sales.Order" o
group by c.CustomerType;
and you will get the Sales grouped by the enumaration-values ‘GoldCard’, ‘Regular’ and ‘ FirstTimer’: