Use the Accounting Calendar Time Periods for Your Rollups
When creating rollups that depend on fiscal year periods, such as current quarter, use the accounting calendar periods. The accounting calendar defines the fiscal year and the time periods within it.
Therefore, the periods that are set based on the accounting calendar are useful when calculating rollups like Revenue from the last fiscal quarter.
In the sales application, predefined period tokens are available that are created based on the accounting calendar time periods.
Accounting Calendar Period Tokens for Rollups
This table lists the period tokens based on the accounting calendar. You use the tokens given in the Token column to define the periods for your rollups.
# | Token | Meaning | Attribute | Description |
---|---|---|---|---|
1 | GL_WTD | Week-to-date | glweekToDate() | The period from the beginning of the current week until today. For example, the current date is Thursday, March 10, and the first day of the week is set in the accounting calendar as Monday. The week-to-date period will be from Monday, March 7, to Thursday, March 10. |
2 | GL_MTD | Month-to-date | glmonthToDate() | The period from the first day of the current month until today. For example, the current date is March 10. The month-to-date period will be March 1 to 10. |
3 | GL_QTD | Quarter-to-date | glquarterToDate() | The period from the first day of the current quarter until today. For example, if the first day of the current quarter is January 1 and the current date is March 10, the quarter-to-date period will be January 1 to March 10. |
4 | GL_YTD | Year-to-date | glyearToDate() | The period from the first day of the current fiscal year until today. For example, if the first day of your current fiscal year is January 1, the year-to-date period will be January 1 to March 10. |
5 | GL_PWTD | Previous Week-to-date | glpreviousWeekToDate() | The period from the first day of the previous week until today. For example, if the week begins on Monday, the previous week-to-date period will be from Monday of the last week until today. |
6 | GL_PMTD | Previous Month-to-date | glpreviousMonthToDate() | The period from the first day of the previous month until today. For example, if the current date is March 10, the previous month-to-date period will be February 1 to March 10. |
7 | GL_PQTD | Previous Quarter-to-date | glpreviousQuarterToDate() | The period from the first day of the previous quarter until today. For example, if the first day of the previous quarter was October 1, 2021, and the current date is March 10, 2022, the previous quarter-to-date period will be October 1, 2021, of the previous year, to March 10, 2022. |
8 | GL_PYTD | Previous Year-to-date | glpreviousYearToDate() | The period from the first day of the previous fiscal year until today. For example, if the first day of your previous fiscal year was January 1, 2021, the year-to-date period will be January 1, 2021, to March 10, 2022. |
9 | GL_PW | Previous Week | glpreviousWeek() | The period from the first day of the previous week until the end of the week. |
10 | GL_PM | Previous Month | glpreviousMonth() | The period from the first day of the previous month until the end of the month. |
11 | GL_PQ | Previous Quarter | glpreviousQuarter() | The period from the first day of the previous quarter until the end of the quarter. |
12 | GL_PY | Previous Year | glpreviousYear() | The period from the first day of the previous fiscal year until the end of the fiscal year. |
How to Use an Accounting Calendar Token in a Rollup
When creating a rollup, you write a query into the Related Object Filter field, defining all the conditions that a rollup needs to consider while calculating the aggregated value. For example, you want to create a rollup that calculates revenue from qualified and unqualified leads. In this case, your Source Object is Account, the Related Object is Lead, and the Related Object Filter query is:
StatusCode IN ('QUALIFIED', 'UNQUALIFIED') AND DEAL AMOUNT IS NOT NULL
This query adds up the revenue or deal amount associated with the qualified and unqualified leads and shows the aggregated value for the rollup.
Now, let’s say you want to calculate the revenue from the previous quarter of the accounting calendar. You need to add the period token, GL_PQ, to the query, as shown below:
StatusCode IN ('QUALIFIED', 'UNQUALIFIED') AND DEAL AMOUNT IS NOT NULL AND LastAssignmentDate=:GL_PQ