How to filter/parameter for different date ranges

0 votes

I am trying to set up a filter or parameter for different date ranges in Tableau, such as:

  1. Previous Week
  2. Previous 4-Weeks
  3. Previous 8-Weeks

Based on the most recent data in the database. Is it possible to only have these options in the filter and have it based on the maximum date in the database?

Jun 20, 2018 in Tableau by ghost
• 1,790 points
674 views

1 answer to this question.

0 votes

Steps:

  1. Create a parameter control that the users will use to change the selected date range. I created this as a list of strings with values that I can use directly in a calculated (after simple casting):

enter image description here

  1. Create a calculated field that you will use as a filter that references the selection of the parameter control. It tests to see if the difference (in weeks) between the maximum date in the view and the date of any given row is less than the value of the parameter.

enter image description here

Calculation: INT([Date Filter Parameter]) > DATEDIFF("week",ATTR([Date Field]),WINDOW_MAX(MAX([Date Field])))

  1. Place the calculated field in the filter box and set it to True.

You will be able to filter your data like so:

enter image description here

enter image description here

enter image description here


Original Answer

Yup - that is built into Tableau.

Add your date to the filter and select the "Relative Date" option:

enter image description here

You can set the defaults - users can change these later:

enter image description here

Then just "Show Filter":

enter image description here

answered Jun 20, 2018 by Atul
• 10,240 points

Related Questions In Tableau

+1 vote
1 answer

Tableau - Filter/Parameter For Different Date Ranges

Based on your comment and updated question, ...READ MORE

answered Jul 19, 2018 in Tableau by Atul
• 5,530 points
70 views
0 votes
3 answers
0 votes
1 answer

How to create a filter based on date range?

You can use this code snippet in ...READ MORE

answered Aug 7, 2018 in Tableau by Nitish
• 630 points
50 views
0 votes
1 answer

How to display days data based on date selected in the filter by the user.

You can create a parameter for dates. Select data ...READ MORE

answered Aug 14, 2018 in Tableau by AwesomeSauce
• 860 points
53 views
0 votes
1 answer

Reset filters in Tableau

I understood your question (I hope so!). ...READ MORE

answered Mar 29, 2018 in Tableau by QueenBee
• 1,810 points
575 views
0 votes
1 answer

How to create a global filter

Assuming you have created a dashboard already, ...READ MORE

answered Apr 12, 2018 in Tableau by QueenBee
• 1,810 points
48 views
0 votes
1 answer

How can I create a second sheet which is filtered to 8 days ago,

Following are the steps you can follow: Create ...READ MORE

answered Jul 11, 2018 in Tableau by Atul
• 5,530 points
38 views
0 votes
2 answers

How can I display filtered value and grand total in the same sheet?

You can create a fixed calculated field ...READ MORE

answered Sep 15, 2018 in Tableau by Machdata
• 340 points
79 views
+1 vote
1 answer

How to add filter on different sheets based on clicks?

Go to Actions… (if you're on a dashboard, you ...READ MORE

answered Aug 1, 2018 in Tableau by Atul
• 10,240 points
48 views
0 votes
1 answer

How to create a bar graph for two fields with same value?

I believe you want to have something ...READ MORE

answered May 28, 2018 in Tableau by Atul
• 10,240 points
42 views