hmmmmm I’m not really a developer, so __I’m never really sure what I’m looking at we’ve these things.
Essentially the only difference between my code and your code are the lines highlighted below
Would the code be failing because your model is an Opportunity model, whereas mine is an OpportunityLineItem model?
Here is my aggregate model
Here is my grouping