1 of 1 people found this helpful
One possible approach is to create some date parameters. Since parameters are single value only, you'll likely need 4 of them (start and end for the first range; start and end for the second range. Then you can create a calculated field that uses the values of the parameter to group your values:
IF [Date Field] >= Parameter_Range1_Start AND [Date Field] <= Parameter_Range1_End THEN "Time Period 1" ELSEIF [Date Field] >= Parameter_Range1_Start AND [Date Field] <= Parameter_Range1_End THEN "Time Period 2" END
Anything that doesn't fall within the two ranges will evaluate to NULL. You can place the [Date Range] field on the filters shelf and exclude NULLs. Put it on the Columns shelf to define column headers for the Periods.
Hope that helps!
Thank you Joshua! Worked like a charm!
Two follow up questions --
- Let us say I wanted to have a radio button like in the mock up below (highlighted in red) that says "MTD vs PMTD". Assuming today is 01/21/2014-- selecting this radio button should automatically set --Start 1 to 01/01/2014, Start 2 to 01/21/2014 , Start 3 to 01/01/2013, Start 4 to 01/21/2013. Any pointers on how I can get to that will be greatly appreciated
2. Instead of having four different boxes for date is it possible for me to have two sliders? Something like below? That may make it more user friendly.
You might check out some of the ideas that have been proposed by Tableau users for enhancements to parameters and vote them up (who knows, maybe future versions will include some of the suggested features). And if you don't see an idea that matches exactly what you want, go ahead and create it (please also link to it in a response in this thread so anyone who happens upon it will be able to vote it up too).
Here are some ideas that seem to match what you want: