So there are a couple of ways to do this...the easy way is to hide the year, that way the Table Calc (YoY) still has access to the previous year, so it can calculate the variance
the slightly harder, but more future proof way would be to use a Table Calc to hide the year. Due to the order of operations, Table Calc filters are applied last so have the affect of filtering the view and not the data (this is what I've done in the attached)
I've first created an index calc and set the compute using as such
by using the sort, my last years are always index 1 & 2. I can then drag this to the filter shelf and select just 1
Hope this does the trick, and makes sense.
Map Example - SR.twbx 1.2 MB
Thanks for this. Have gone with the first option for now as I don't quite follow why you created a calc field for the order date and then quite how the index field works in relationship with that. I'll have to study a bit more!
Excellent stuff!...I'd start with the calculation on-demand videos, these will take you through Row Level Calcs, Aggregate Calcs and then onto Table Calcs...in fact your YoY sales measure is a Table Calc (if you double click that pill you can see the formula Tableau has built using Table Calculation...the quick table calc is just a short cut for the most common uses). The key to table calcs is that you can define the level (and with sort the direction) they are calculated over.
There are also some great blogs out there here a link bringing together the best one (going from starter to expert) Want to Learn Table Calculations? Here’s How! | Drawing with Numbers
...and this TDT video is also a great explanation