How to Use periodoverperiod Function

Hi,

I want to use periodOverPeriod to show the previous year value for a metric. However, I do not the syntax for the return_expression of the function: periodOverPeriod(aggregated measure, date, period, return_expression, offset (optional) ). I tried to search for it but it is not in the documentation. Can you please help with this?

Thanks,
Alan

Hi Alan - here is the documentation on the periodOverPeriod function:

Does this help to clarify the required input parameters?

Hi wanjes,

What I am trying to do is this show sales year over year like this:

Date           Sales       Last Year Sales
May 2022       1000        900
April 2022     800         850

Can this periodoverperiod help me achieve that or is there a better way?

Thanks,
Alan

I would use a lag function for this.

lag(
sum({Sales}),
[{Date} ASC],
1
)