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?
3 Replies
waseigo
waseigo3y ago
+1 I'm also interested in learning how to do this
ZachDaniel
ZachDaniel3y ago
At this point I think a custom calculation would be the best way, yeah. I’m going to look into aggregates of aggregates before long, but that won’t solve for the grouping.
Alan Heywood
Alan HeywoodOP3y ago
Thanks Zach 😀

Did you find this page helpful?