You are viewing our older product's guide. Click here for the documentation of GoodData Cloud, our latest and most advanced product.
PREVIOUS Macro
The PREVIOUS macro is used to select the attribute value for the date dimension that immediately precedes the current value.
In the following example, PREVIOUS means “previous quarter.”
SELECT Payment WHERE Quarter = PREVIOUS
In the next example, PREVIOUS means “last quarter” and THIS references “this day, last quarter” (for example, February 2^nd^ and May 3^rd^ are both day 33 of their respective quarters, so they have the same Day of Quarter value).
SELECT # of Employees WHERE Quarter = PREVIOUS AND Day of Quarter = THIS
PREVIOUS is identical to THIS - 1. To reference the previous time period, use the PREVIOUS macro.
Note - for differences between FOR Previous and FOR PreviousPeriod see Functions For Referring to Past Time Periods