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 21, 2018 in Tableau by ghost
• 1,790 points
5,079 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 21, 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 20, 2018 in Tableau by ffdfd
• 5,550 points
1,291 views
+1 vote
4 answers

How to Update my Start and End dates parameter or Filter with Today and Last 5 Days Date Automatically ??

Create a calculated field and set its ...READ MORE

answered Jul 31, 2019 in Tableau by anonymous
2,991 views
0 votes
1 answer

How to create a filter based on date range?

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

answered Aug 8, 2018 in Tableau by Nitish
• 630 points
1,049 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 15, 2018 in Tableau by AwesomeSauce
• 860 points
1,671 views
0 votes
1 answer

Reset filters in Tableau

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

answered Mar 30, 2018 in Tableau by QueenBee
• 1,820 points
4,060 views
0 votes
1 answer

How to create a global filter

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

answered Apr 13, 2018 in Tableau by QueenBee
• 1,820 points
1,494 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 ffdfd
• 5,550 points
905 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
1,131 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
977 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 29, 2018 in Tableau by Atul
• 10,240 points
1,022 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP