Loading

Creating a Relative Date Filter with Slider

Publiceringsdatum: Feb 25, 2026
Uppgift

How to create a quick-filter slider that filters the view based on a date relative to today’s date.

Steg

The following steps use the view and data source included in the sample Tableau workbook, RelativeDateFilter_2023.twbx, found in the Attachments section of this article.  Download the workbook to follow along with the steps.

  1. Select Analysis > Create Calculated Field.
  2. Name the field Relative Date (Months), and, in the Formula box, build the following formula:

    DATEDIFF('month',<date>,Today())

    Where <date> is the name of the date field you want to use in the filter.

  3. From the Measures pane, drag Relative Date (Months) to the Filters shelf.
  4. In the Filter Field dialog box that opens, click Next.
  5. In the Filter dialog box that opens, click OK.
  6. From the drop-down menu on the instance of Relative Date (Months) that is on the Filters shelf, select Show Filter.

Using the slider, you can specify the number of months to display in the view, between today and the <date> field.

Tip: You can edit the title of the quick filter to make it more intuitive for your viewers. For example, change it to Months from Today.

Ytterligare resurser
NOTE: The sample packaged workbook was created in September 2023 using an extract of the Tableau default Sample - Superstore data source. As a result, date slider values may be updated to reflect a different range when opening the workbook on your machine.
 
Knowledge-artikelnummer

001466275

Bilagor

RelativeDateFilter_2023.twbx

345 KB

 
Laddar
Salesforce Help | Article