+ Start a Discussion

Total number of accounts in Reports

We have a requirement where we have to show the total number of accounts created during every month and showing the total number of accounts in same table.

                      No.of records for the month    Total number of Account records
Jan 2016                         10                                        30
Feb 2016                         20                                        50
Mar 2016                         40                                        90

Number of accounts for a month i have implemented, but the total no. of account record is possible?

SandhyaSandhya (Salesforce Developers) 

Hi Vivekh88,

You can use aggregate function COUNT() to get the total records.

Please see below code.
AggregateResult[] arList = [select count(id) from Account];
System.debug(LoggingLevel.INFO, arList[0].get('expr0'));

Please refer below link for more information on aggregate functions.

Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.


Thanks and Regards


Hi Sandhya

I need to do this in reports. Is there any option like formula type where i can aggregate total number of accounts and show them in seperate column.