Don't do that with a filter.
Use a parameter to select the year, and then you can make a calc to pull up the two years you need.
IF [Year] = [Parameter] or [Year] = [Parameter]-1 then 1 else 0 END
Put that calc on the filters shelf and select for value =1.
it's not working for me.
Post a sample workbook showing how far you got. "It's not working" doesn't give me anything to go on.
If you need to anonymize your data, follow the steps in the video linked here: