You were on the right track thinking about a filter, however most Tableau filters act on the data pre-calculation, so the data isn't availble for the year over year calcs. Filters on Table calculations, on the other hand, are applied after other calculations so you can set one up to show or hide the data.
I first created a parameter to let the user pick how many months back, just to test it out. You might switch this back to a date parameter if you want, the next calc would need to change.
Here's the Show/Hide calculation I created:
LOOKUP(ATTR(IF DATETRUNC('month',[Order Date]) = DATETRUNC('month', DATEADD('month',-[Choose Months Back],NOW()))
OR DATETRUNC('month',[Order Date]) = DATETRUNC('month', DATEADD('month',-[Choose Months Back]-12,NOW())) THEN
LOOKUP() is a table calculation function, it needs to be given an aggregate, so we wrap the IF statement in an ATTR(), and the 2nd argument to lookup is the row within the partition, so LOOKUP(foo,0) like we're doing returns the current value.
Drag that onto the Filters shelf and select Show, and you should be all set. I've attached the workbook I created this in.
LY jtd edit.twbx.zip 44.8 KB