Thomas Karbe
08/12/2024, 11:30 AMFOR PreviousPeriodFrancisco Antunes
08/12/2024, 12:41 PMRevenueSELECT Revenue FOR PreviousPeriod(Year (Date))Thomas Karbe
08/12/2024, 12:45 PMFrancisco Antunes
08/12/2024, 1:11 PMOn 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.So if you use FOR PreviousPeriod(Year) on your metric, for example, but slice it by Month, the metric will actually show the value for the previous Month (the new smallest granularity), not the previous year. That seems to cause the offset values on the graph. So to show the previous year in an insight with the Month granularity, the metric would actually have to be:
SELECT Revenue FOR PreviousPeriod(Year (Date),12)SELECT Revenue FOR Previous(Month/Year (Date),12)Thomas Karbe
08/12/2024, 1:19 PMThomas Karbe
08/12/2024, 1:45 PMThomas Karbe
08/12/2024, 1:46 PMFrancisco Antunes
08/12/2024, 2:23 PMThomas Karbe
08/12/2024, 3:11 PM