Tableau - Filter Parameter For Different Date Ranges

+1 vote

What I want is 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 this possible to only have these options in the filter and have it based on the maximum date in the database?

Jul 20, 2018 in Tableau by xyz
• 1,560 points
1,286 views

1 answer to this question.

0 votes

Based on your comment and updated question, you can do it as you intend, though it isn't as straight-forward.

NOTE: I did this very quickly and with a random data set, so it will be important for you to test this thoroughly with your data set.

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

Learn How to change the filter values based on the parameters in Tableau?

answered Jul 20, 2018 by ffdfd
• 5,550 points

Related Questions In Tableau

0 votes
1 answer

How to filter/parameter for different date ranges

Steps: Create a parameter control that the users ...READ MORE

answered Jun 21, 2018 in Tableau by Atul
• 10,240 points
5,076 views
0 votes
1 answer

How to add parameter and calculated field filter in tableau?

Hi Sindhu,  You cannot add parameter as a ...READ MORE

answered Mar 8, 2019 in Tableau by Cherukuri
• 33,030 points
5,134 views
0 votes
1 answer
0 votes
1 answer

Changing filter values based on parameter selection - Tableau

Hi, I will show you an example ...READ MORE

answered Apr 4, 2019 in Tableau by Cherukuri
• 33,030 points
31,386 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
9,945 views
+2 votes
1 answer
0 votes
1 answer

Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
1,621 views
+2 votes
1 answer
+1 vote
1 answer

How can I filter data on different sheets based on clicks on Tableau

Filter actions are an essential and fundamental ...READ MORE

answered Jul 20, 2018 in Tableau by ffdfd
• 5,550 points
10,914 views
0 votes
1 answer

What are the important question for a Tableau Interview?

Here is a link to the blog ...READ MORE

answered Apr 25, 2018 in Tableau by ffdfd
• 5,550 points
1,128 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