This is very similar to the problem described here:
And using the technique Richard Leeke described, Create a calculated field using the LOOKUP() table calculation function to use for the filter. This filter will only be applied after evaulating the moving average, so has the effect of removing the entries from the display without affecting the calculation.
So I created a new Calculated Date field, called [Order Date for Filter], and used that for the Order Date filtering.
And used a normal Percentage Difference across the table for the Sales.
I may be misunderstood so I changed the twbx file as attached.
What I want is to see the last of what I filtered for now.
In the attached file, as you move the Order Date scroll, orange and blue circles have to show the sales of the filtered time period and last year sales figures of same date range. But it does not.
is the problem more clear now?
thanks in advance.
Sample.twbx.zip 1.1 MB
Afraid I've been trying to work on this and am not getting much headway, sorry!
I am unable to open your attached workbook as my employer is still using Tableau 6.1. However I have done something similar to what it sounds like you're trying to achieve.
My solution was to use parameters to select the date - i.e. have a start date and an end date parameter. From that you can build calculated fields for this year and last year which should enable you to do the desired comparison.
2 calculated fields will be required, one for last year and one for the selected period. If we call the selected period calc ThisYear the field would be something like:
IF Date >= StartDateParameter AND Date < EndDateParameter THEN Sales END.
The calc for last year would be very similar but using dateadd to minus a year:
IF Date >= DATEADD('year',-1,StartDateParameter) AND Date < DATEADD('year',-1,EndDateParameter) THEN Sales END
Without seeing you vis it's hard to advise much more. You might need to create some sort of calculated field to act as a filter, it all depends how you're trying to display the data. I was using this data in a bullet chart to didn't display any time period on the X axis so didn't have to do any date based filtering so these calc fields worked really well for me. Hopefully this will help a bit.