THIS macro references the current value for the specified attribute of the Date dimension.
In the following example, THIS macro inherits the day granularity from the Date attribute. Here THIS means this date, or “today”:
SELECT Payment WHERE Date = THIS
If the granularity of the date attribute changes, so does the meaning of THIS.
Using arithmetic with THIS
You can use addition and subtraction with THIS macro to reference future or previous time periods. For example, suppose the current date is November 3, 2014.
With the following MAQL expressions,
SELECT COUNT Event WHERE <date_attribute> = THIS + 2
SELECT COUNT Event WHERE <date_attribute> = THIS - 2
THIS macro returns date attribute values as shown in the following table:
Date attribute (partial list)
THIS + 2
THIS - 2
Day of Week
Notice that if the date attribute is periodic, such as quarter (Q1, Q2, Q3, Q4) or month (January, February, March, etc), using addition or subtraction with THIS macro can make the date attribute roll over or backward to the next or previous period.
THIS - 1 is identical to PREVIOUS. THIS + 1 is identical to NEXT. To reference the previous or next time period, use the PREVIOUS or NEXT macro. See PREVIOUS Macro or NEXT Macro.