You may want to simplify your problem a bit
to make a solution in Tableau simple as well.
What if your Relative Date Filter would be set
using the following (mental) rule:
-- the Date Range would be an even number of Days
the size of both Current and Previous periods together.
If you compare 7 days, the filter should be set to 14.
With the filter set according to the rule, one could simply
divide the whole range into two periods of the same size.
This would be a Dimension -- to make a view simple to build.
Note that for the solution to work as expected
your data should be 'dense' enough.
At least there should be rows in the data (Marks on a view)
for the first and the last days of the filtered Date Range.
This is needed to calculate the exact same size of Curr & Prev.
Besides, for a 'dual-axis' effect on a view,
one could simply 'shift' the dates for the Prev.
Please find the attached as an example.
Hope it could help a bit.
Curr_vs_Prev_v10.2_YF.twbx 2.3 MB
Thanks for explaining your method; it's interesting how we all approach a problem differently.
Would you mind attaching the workbook again as I don't see it?
1 of 1 people found this helpful
The attached workbook is there.
Please open the thread in browser
and look at the lower left of my reply.
Perfect, that's exactly what I was looking for! Sorry that I didn't see the workbook earlier.
The only issue is that my relative date field is set to continuous (same as the Order Date in your example), yet only one line shows.
However when the relative date is set to discrete (ie not relative anymore) then the graph displays with 2 lines as desired.
So how do I show both lines whilst having a continuous (and relative) date filter?
Oh I realized that the date filter has to be Added to Context.
Fixed, thank you very much!
Steffi, you're welcome.