Ash FrameworkAF
Ash Framework3y ago
3 replies
Alan Heywood

Alternative approach for aggregate of aggregate with group by

Assuming three resources: A has_many B has_many C, and a requirement to calculate, for each record A, the sum of distinct C.status values, grouped by C.status.

I tried implementing this via the ash DSL, however I think I would need a few features not yet implemented such as "aggregate of aggregate" and "group by aggregate". Would a custom calculation and falling back to ecto be the best way forward?
Was this page helpful?