You need to sign in to do that
Don't have an account?
Cthulhu42
help with PREVGROUPVAL
Hey-
I'm trying to create trending reports on analytic snapshots I've captured similar to the Opportunity Trend 3 report in here: http://www.salesforce.com/community/spring09/administrators/force-database/summary-rpt-data.jsp#. I'm pretty sure I need to create a custom summary field, but I'm not really sure how to do it. I can't seem to get the syntax right. Can someone point me at some examples?
Thanks!
I have a similar issue, and the documentation on PREVGROUPVAL is spotty. It is new and that is understandable.
I am trying to create trailing twelve month (TTM) reports and corresponding dashboard charts. As anyone who has used TTM (or TT weeks or days) charts knows, they are one of the best financial analytic tools available to a manager. The beauty of them is the way they remove seasonality from a business's financial results. As such, when they go up, it is good. When they go down, it is bad.
BACKGROUND: We have a custom tab/object in salesforce called Financials into which we record our financial results. There is one record per period (week, month, quarter & year). On each record, we have all the predictable metrics like revenue, expenses etc. Accordingly, I can easily write a report that shows monthly sales results for the last 36 months. One column has the last date of the month and the other has the monthly sales figure like this:
Last Date Sales
1/31/08 $200,000
2/28/08 $250,000
.........
12/31/08 $225,000
CHALLENGE: To create TTM charts, I need plot the SUM of the previous 12 months of sales results on a chart every month. Thus, I think I need to do one of two things to achieve this in salesforce. Either, 1) create a new field on each record which somehow refers to the previous period's record and the 10 before that and adds those figures to the most recent period's record; or 2) (more likely) use PREVGROUPVAL to refer to the previous periods on a report and SUM them together as described above. That might look like SUM of 12 different PREVGROUPVAL results using this form:
PREVGROUPVAL(summary_field, grouping_level [, increment]) + PREVGROUPVAL(summary_field, grouping_level [, increment]) and so on.
If implemented correctly, my resulting report would look as follows (with any luck I can get a Dashboard to graph the TTM results too).
Last Date Sales TTM
1/31/08 $200,000 $2,600,000 (the previous 11 months plus this one)
2/28/08 $250,000 $2,850,000 (jan ttm plus feb's results)
.........
12/31/08 $225,000 $4,150,000 (the sum of the previous 11 months plus dec)Two questions for the Community:
1) Using PREVGROUPVAL, what would my grouping level be? I don't seem to be able to figure that out. So far, I have this: PREVGROUPVAL(Sales, grouping_level [, 1]). Is that suppossed to be -1,-2 etc?
2) Am I thinking about this the right way/Is there a better (easier/more elegant) solution? I tried an analytic snapshot, but I got frustrated. I tried a matrix report, same result.
In Excel, this is a 2 minute problem I know, and my fallback solution is just to do this manually... but what fun would that be???!!!! Plus, this is so easy to describe, I think it is possible somehow.
Thanks,
Ken
1) Using PREVGROUPVAL, what would my grouping level be? I don't seem to be able to figure that out. So far, I have this: PREVGROUPVAL(Sales, grouping_level [, 1]). Is that suppossed to be -1,-2 etc?
Group by Last Date value (hopefully that is a Date field in salesforce... if it is a text field, you'll have problems)
2) Am I thinking about this the right way/Is there a better (easier/more elegant) solution? I tried an analytic snapshot, but I got frustrated. I tried a matrix report, same result.
I think you are on track.
You will need to use the "Increment" feature of the PrevGroupVal function as you sum the previous 11 months toghether:
PREVGROUPVAL(Sales, grouping_level) + PREVGROUPVAL(Sales , grouping_level , 1) + PREVGROUPVAL(Sales , grouping_level , 2) .... all the way to .... + PREVGROUPVAL(Sales , grouping_level , 11)