KNOWLEDGE BASE

Creating a Date Filter that Defaults to Yesterday's Date


Published: 15 May 2013
Last Modified Date: 04 Jan 2017

Question

How to create a date filter that always defaults to yesterday's date.

Environment

Tableau Desktop

Answer

Step 1: Create a Calculated Field to Use as a Filter
  1. Open Tableau Desktop and select Analysis > Create Calculated Field to create a calculated field.
  2. In the Calculated Field dialog box that opens, enter a name for the field.
  3. In the formula field, create a calculated field similar to the following:
    [Date Field]=today()-1
    where [Date Field] is the date field being used in the view. Click OK.
  4. Drag the newly created calculated field from the Dimensions pane to the Filter shelf.
  5. In the Filter dialog box that opens, select True, and then click OK.
Step 2: Filter the Date Field
  1. Drag the date field represented by [Date Field] in the formula in Step 1 from the Dimensions pane to the Filter shelf.
  2. In the Filter field dialog box that opens, select  Month / Day / Year, and then click Next.
  3. Select Select from List, select All, and then click OK.
  4. Right-click the date field on the Filters shelf and select Show Quick Filter.
  5. Click the drop-down menu of the [Date Field] quick filter and select Only Relevant Values.
Did this article resolve the issue?