I am trying to include an additional currency field in the below Group By query, but receive SOQL error.

"Field must be grouped or aggregated".

Is it possible to add a Currency Field to a Group By Query and still display the same result set w/ same # of rows?

Select Deal_Transaction__c, Investing_Entity__c, 
Original_Amount_of_Investment__c, SUM(Current_Investment_Amount__c)
From Investment__c
Where Investor_Account__c = '001E000001All68IAB' and 
Group By Deal_Transaction__c, Investing_Entity__c
  • The error message is actually quite descriptive. An AggregateResult represents a collection of records. The collection doesn't have an Original_Amount_of_Investment__c value. What are you trying to accomplish? You can sum it, average, min, max, etc, but no you cannot display the value of that field because it doesn't even make sense what that would represent.
    – Adrian Larson
    Jun 26, 2017 at 20:54

1 Answer 1


Every field that is in the select statement of an Aggregate query must be either an aggregated field (Count, Sum, etc) or be present in the Group By query,

Your problem is that Original_Amount_of_Investment__c is not in the Group by. Add it (ideally at the end) and the query will work.

You have to keep in mind that adding a new field to your Group By will significantly change how your query is made. In this case, that means that the aggregation will now break by Amount of Investment. That may not be what you need.

If that is indeed NOT what you need, then the addition of the field makes little sense. Think about it, if you're aggregating several different "Amounts of Investment"... then which one of those records are you trying to show? One? All? The answer to that question will outline your next steps.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .