KNOWLEDGE BASE

Displaying Only Business Days


Published: 21 Nov 2013
Last Modified Date: 18 Sep 2017

Question

How to filter a date field to display only business days.

Environment

Tableau Desktop

Answer

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

  1. In Tableau Desktop, connect to Superstore Sample Data.
  2. Drag Order Date to Rows.
  3. Right-click Order Date on Rows, select More > Custom, under Detail select Month / Day / Year, and then click OK.
  4. Drag Order Date to Rows again.
  5. Right-click Order Date on Rows, and then select More > Weekday.

Step 2: Create the Calculated Field

  1. Select Analysis > Create Calculated Field.
  2. 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?.
  3. 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
  4. Drag the newly created calculated field from the Dimensions pane to Filters.
  5. In the Filter dialog box that opens, select True, and then click OK.
Note: the above steps are for discrete dates.

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
Did this article resolve the issue?