function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SainSain 

How to Caluculate Sum of Amount spend by individual per month

Hi,

I have requirement to display total amount spend by individual per partucular month like shown below, i have Name, Amount__c fields in custom object.  


Name              Current Month Total Amount
Name1                      10000
Name2                        5000
Name3                       40000

if any one can provide me a sample code how to achive this it would be great thankfull.

Thanks In Advance
Sain
William TranWilliam Tran
Here you go.

Do a find: "customObject" and replace with your custom object name
 
<APEX:PAGE standardcontroller="customObject__c" recordsetvar="customObjects__c">

<APEX:FORM >
       <apex:pageBlock title="Custom Object"  id="test">
            <apex:pageBlockTable value="{!customObjects__c}" var="co">
                <apex:column headerValue="Name" value="{!co.Name}"/>
                <apex:column headerValue="Amount" value="{!co.Amount__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
  
</APEX:FORM>
</APEX:PAGE>

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 

Thanks
SainSain
Hi William,

Here Amount is sum of amount__c spend by particular user in whole month.

for example: i have user vinod, he has created 5 records(record1 Amount is 10,record2 Amount is 100,record3 Amount is 10,record4 Amount is 250,record5 Amount is 50)in particular month.  now i have to display as below

Name                 Current Month Total Amount
vinod                  420(this value is sum of amount spend by particular user for whole month )
ganesh               1000

Regards,
Sain