Last Modified Date: 20 Jul 2023
Environment
Tableau DesktopAnswer
To filter a date field to display only business days, you will need to create a calculated field that determines whether the date is a business day.
Step 1: Create the View
- In Tableau Desktop, connect to Superstore Sample Data.
- Drag Order Date to Rows.
- Right-click Order Date on Rows, select More > Custom, under Detail select Month / Day / Year, and then click OK.
- Drag Order Date to Rows again.
- Right-click Order Date on Rows, and then select More > Weekday.
Step 2: Create the Calculated Field
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box that opens, enter a name for the field. In the Filter to Business Days example workbook, the field is named Is Business Day?.
- In the formula field, create a calculated field similar to the following, and then click OK:
DATEPART('weekday',[Order Date]) <> 1 AND DATEPART('weekday',[Order Date]) <> 7
- Drag the newly created calculated field from the Dimensions pane to Filters.
- In the Filter dialog box that opens, select True, and then click OK.
Additional Information
Tableau Desktop assigns the following numerical values to days of the week:
- Sunday - 1
- Monday - 2
- Tuesday - 3
- Wednesday - 4
- Thursday - 5
- Friday - 6
- Saturday - 7
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials