Does this work for you?
"This Week - converted"
IF datename('weekday',TODAY()) = 'Sunday'
"Week - Grouper"
IF Datename('weekday',[Date]) = 'Sunday'
IF [Week Grouper] = [This Week converted]
Then set "Filter" = Show
Test Data.twbx.zip 13.2 KB
Could you not also use this as a relative filter - fake the day
It may have to be plus one instead...
EDIT: Nope, it's -1 and seems to work okay
Your logic is working properly and able to change to week or month levels. But displaying dates on the relative filter is wrong which mean it is displaying as calendar date. Is there a way to resolve this?
Date issue.jpg 28.8 KB
Thanks for your prompt reply. But the logic is not working as expected. You are subtracting 1 day using DATENAME function but when we use DATEPART function then it is automatically calculating based on calendar date.
Raghu's solution on the post you mentioned uses a technique to mark the dataset as "Current Week" and something else. Through SQL. So that the data in Tableau can be filtered on that field.
Am sure you wont need this after 2 years now but just posting my understanding here so that it helps someone else like me who comes hunting on this topic
We don't have option of default value for Quick filter, but use the use the following steps it will give you near solution to your query.
1) Create a calculation
Name :Week No
"Week " + if datepart("week", [Date]) <= datepart("week", today()) then str(datepart("week", [Date])) end
2) Create another calculation
Name: Lees than or Equal of current week
Syntax: date([Date]) <= date(today())
3) Drag Week No onto Row shelf, drag Lees than or Equal of current week onto filter shelf then select TRUE
4) right click on Week No, click on Sorting. select "Descending"