Search code examples
salesforceapex-codevisualforceapexsoql

Monthly Revenue Split Custom report using Salesforce


I am attempting to create a report that would provide me a month to month break down of revenue based on the opportunity's start date, end date and Total Revenue to be expected.

Example: Start Date: 2014-08-03 End Date: 2014-12-12 Estimated_Revenue_Won: 185960.00


Revenue Per Day: 1419.5419847328244

August: (2014-08-03 to 2014-08-31)* Revenue Per Day = 39747.175572519072 .... September: 41166.717557251896

How can I do something like this? I have created a custom formula which calcualtes this revenue per day. But how would I gather the number of days in the month and create a report. Would this be done via an Apex class?


Solution

  • I would suggest that you either write an Apex Class which would calculate the Number of Days per month Between the start date and the end date. Then using those days multiply this with Revenue per day as you highlighted earlier.

    Now if you are looking to make this similar to the Salesforce built in report (using grouping, ordering columns), this would not be the avenue that I would choose.

    In that case I would suggest that you export all opportunities data, dump into SSRS and create a report within there. It will be a lot easier to format and modify.