
Hi Experts
I'm working on trying to solve a problem where if the date is today then it should display values for next week ending Thursday. More details below:
DateDate_calc10-25-1910-31-1910-26-1910-31-1910-27-1910-31-1910-28-1910-31-1910-29-1910-31-1910-31-1910-31-1911-01-1911-07-19
I'm attaching the workbook as well for your reference. I have a SQL query for this problem but need a workaround in Tableau.
CASE WHEN DAYOFWEEK(now()) > 5 THEN DATE(now()+ INTERVAL (12 - DAYOFWEEK(NOW()) ) DAY)
else DATE(NOW() + INTERVAL (5 - DAYOFWEEK(NOW()) ) DAY) end as goal_date
Any help/recommendations would be highly appreciated.
Thanks
Kanu
Kanu,
Here is a general method for shifting to the upcoming Thursday:
IF [Update Time (ISO Weekdays)]<=4
THEN DATEADD('day',4-[Update Time (ISO Weekdays)],[Update Time])
ELSE DATEADD('day',4+7-[Update Time (ISO Weekdays)],[Update Time])
END
Where [Update Time (ISO Weekdays)] was created using the Custom Date function:
Would you please clarify what you want it to do for Today?
Is it that you only want to shift it next Thursday for the current day,
but leave all the other dates as is?
Please see workbook v2019.3 attached in the Forum Thread:
Display next week ending Thursday