Use a calculated field as constant reference

Try using this:

avgOver(ifelse(date} < parseDate('12/31/2022', 'MM/dd/yyyy'), {sales}, NULL), [], PRE_FILTER)

You need to use PRE_FILTER in this position to avoid the filters affecting the value.

PRE_FILTER and PRE_AGG are not supported with avgif, but using ifelse here should work how you have it set up in your calculation.

You can read more about how these function here:

2 Likes