• #9450
    Salesforce | Ajit Ajit #291

    Formula Field in Aggregate Salesforce Query

    Can any body suggest me how can i use the formula field in a aggregate soql query because when i am using the field it is throwing error that this field can’t be grouped or aggregated


    select count(id), formula__c from Object__c group by formula__c


    Salesforce | Suyash Suyash #292

    Hello Ajit,

    Formula fields are not “groupable” i.e they are not usable in the GROUP BY clause of a SOQL query.

    Salesforce | Ravi Ravi #277

    Hi Ajit,
    Formula Fields cannot be used with the group by clause in SOQL query
    You can check whether a field is “groupable” or not using DescribeFieldResult.
    Schema.DescribeFieldResult resultObject= Object__c.formula__c.getDescribe();
    if(resultObject.groupable == true){
    formula__c is groupable
    formula__c is not groupable

    • This reply was modified 2 years, 11 months ago by Salesforce | Ravi Ravi.
    Salesforce | Parul Parul #3

    Hi Ajit

    To Check whether any field is “groupable” or not,Please follow the below procedure

    Schema.DescribeFieldResult fieldDescribe = ObjectName.FieldName.getDescribe();

    if(fieldDescribe.groupable == true){

    Then Our Field is Groupable



     William #1

    Formula fields are not “groupable” – that is, they are not usable in the GROUP BY clause of a SOQL query. There is limitation like Formula fields can’t use in the group by Clause.

     Divya #8


    Formula fields are not groupable they are not usable in the GROUP BY clause of a SOQL query.

Viewing 6 posts - 1 through 6 (of 6 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?