Hi Tableau community,
I have the base code for the case statement below, but I'm not sure what the best function is to define these ranges so that it will work as required when added to the filter shelf.
Parameter = [DateRange]
Dimension = [Date]
CASE [DateRange]
WHEN '12 Months' THEN
Need logic that uses [Date] to define range 12 months prior to the current date
WHEN '6 Months' THEN
WHEN '3 Months' THEN
WHEN 'Year to Date' THEN
END
Thanks for any help!
Kevin
You can install different versions of desktop on your machine simultaneously--which is a good idea anyway, as you can test features of the newer version while continuing to use an earlier release.
There is no CASE statement in this workbook, but the main calculation for choosing the date range is:
IF [Date Selection]=1 AND Date <= today() and Date >= dateadd('day', -6, today()) THEN [Date]
ELSEIF [Date Selection]=2 AND Date <= today() and Date >= dateadd('week', -4, today()) THEN [Date]
ELSEIF [Date Selection]=3 AND Date <= today() and Date >= dateadd('month', -2, today()) THEN [Date]
ELSEIF [Date Selection]=4 AND [Date] <= [End Date] and [Date] >= [Start Date] THEN [Date]
END
{Date Selection] is a parameter with 4 different options (1-4). Hope this helps.