You need to sign in to do that
Don't have an account?
Jordan Frank
Y.T.D. Variance Report - Custom Formula
Hey guys, I am looking to create an executive summary that shows our monthly margin contribution - quota to give me a variance. Currently I have a matrix report, the columns are the months while the row is a group I have to use because of complicated margin capture methods. Essentially the top column will read: January | February | March etc.. Within these columns I want to have Total Amount (For that month), Total Margin Contribution (For that month), Quota (A pre-set amount that doesn't change by month), Y.T.D. Variance. Y.T.D. Variance would equal that months margin - quota. The next month would equal that months margin - quota + PREVIOUS MONTH. This is the hard part. Obviously January is easy to do, but then February is going to simply take Feb. Margin - Quota. I am not sure how to add in the previous month's variance in order to keep a running total. Any ideas?
All Answers
PREVGROUPVAL
Description:This function returns the value of a specified previous grouping. A “previous” grouping is one that comes before the current grouping in the report. Choose the grouping level and increment. The increment is the number of columns or rows before the current summary. The default is 1; the maximum is 12. You can only use this function in custom summary formulas for reports.
Use:PREVGROUPVAL(summary_field, grouping_level [, increment])
Where summary_field is the name of the grouped row or column, grouping_level is the summary level, and increment is the number of rows or columns previous.
Example:AMOUNT:SUM - PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE)
This formula calculates, for each month, the difference in amount from the previous month shown in the report. In this example, the report is an opportunity matrix with columns grouped by Close Date and rows by Stage.
Source: https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_functions_i_z.htm&language=en_US
I am able to correctly sum the first two months variance but then the 3rd month is calculated incorrectly. Here is my formula.
Opportunity.Total_Margin_Contribution__c:SUM-500000+(PREVGROUPVAL(Opportunity.Total_Margin_Contribution__c:SUM,Opportunity.Month_Book_Date__c)-500000)
** 500000 is the quota I am using in this example. Here is what I think it is doing.
- January Margin - Quota (500000)
- February Margin - Quota + (January Margin - Quota) ** Correct
- March Margin - Quota + (January Margin - Quota) ** This is the error.
In March I need it to take February Y.T.D. Variance + (March Margin - Quota) orJanuary Margin - Quota + February Margin - Quota + March Margin - Quota....
Any ideas?
Book Date: FY 2016
Book Date: FY 2016 - Total Amount - Total Margin Contribution - Monthly Quota - Y.T.D. Variance
January 2016 - X Amount - Y Amount - Z Amount - Y-Z = J Var.
February 2016 - XF Amount - YF Amount - ZF Amount - YF - ZF + J Var.
ETC...
This formula will result in
Y.T.D. Variance
Jan - Blank
Feb - Blank
Mar - Blank
Apr - Blank
Dec - Total Variance.