If you have a date, this is straightforward. If not, I would personally look to convert this to a date. Further follow-up: does the quarter need to be completed? Or just exist?
If just the former, you can create a function using a LOD expression, such as this:
Hopefully this helps! If not, we can try something else.
Thank You for your fast response.
I saw that solution in one of tableau kb.
But the requirement is to show the Quarter as Filter and auto select/check the latest quarter as default selection, and the user have the ability to filter other quarter.
Based on your workaround, we will use the true/false flag as filter right. and auto select the true filter.
What we often do is have two parameters:
DateType: Most Recent/Custom
DatePicker: when Custom, show other dropdown of Quarters
However, if you want one dropdown, one more question: is the end user meant to only select one option from the dropdown (rather than a multiselect as shown in the original post)?
If it's only allowing one option, then by default (when you publish with "All" selected), you can use the function LAST=0:
Doing this will have you always show the final row in the view (which will be the last quarter provided you have it sorted in chronological order).
The user is allowed to choose only single value from the quarter.
Could you help to send me your workbook file that you produced the screenshot above
Thanks a lot
Perfect. Then here's how I did it last night. Then you can change the quarter option in the filter as desired. However, I woke up and realized a better way and am adding that as another reply below.
Attached a 10.3 twbx.
MostRecentQuarter_10.3.twbx 1.2 MB
Better solution and sorry for not thinking of this last night (it was late!):
Drag your relevant date onto the sheet. Then drag it to the Filters pane. You can pretty much click through everything as it doesn't really present the option you want.
Once on there, change the format to Quarter:
Now you must go to the dropdown again and convert to Discrete if it isn't already. After this select "Edit Filter" and you can go to the bottom of the window and select "Filter to latest date when workbook is opened":
This then actually selects the option in the filter as I imagine is desired:
With this you could actually remove the "All" option then if you wanted. Attached for you here as well.