The following MAQL functions allow you to create metrics showing a time over time comparison (for example, month over month, or quarter over quarter) of past time periods:
Differences Between FOR Previous and FOR PreviousPeriod
The difference between the Previous( ) and PreviousPeriod( ) functions becomes clear when the date attribute in a report is smaller that the time period specified within the function's parentheses.
FOR Previous( ) strictly follows the date attribute specified by the metric author within the parentheses of the function.
On the other hand, FOR PreviousPeriod( ) adapts to the context of the report at hand. Regardless of the date attribute specified by the metric author, the PreviousPeriod( ) function takes on the date attribute of the smallest granularity from the report.
In the following example, even though the metric in the final column has been defined as FOR PreviousPeriod(quarter), the function returns values from the previous month, as month is the most granular date attribute in this report.
Even if PreviousPeriod( ) automatically takes on the granularity of the smallest date attribute in a report, it is still important to specify a date attribute within the PreviousPeriod( ) function as a way of specifying the date dimension of interest. This is because projects often have multiple date dimensions, such as Date(Lead Created), Date(MQL Qualified), or Date(Snapshot).