Ash FrameworkAF
Ash Framework5mo ago
8 replies
nagieeb

How can I sum all the expenses.amount across all categories

I have a Category resource inside a Wallet domain.
The Category has an attribute monthly_budget of type :money.
Each category has many expenses, and each expense has an amount (also :money).

On a domain level (in Wallet):

How can I sum the monthly_budget of all categories?

How can I sum all the expenses.amount across all categories?


Should I define an aggregate on the resource, or is there a recommended Ash way to sum :money attributes across multiple records?

Thank you in advance
Was this page helpful?