Tableau Dashboard Tips: Auto update filters when the data refreshed daily

Hi All,
This post is the first in the series where I will be discussing with tips and trick to enhance your tableau dashboard and make it more user freindly.
Lets take up the following scenario in the post. Imagine you have a report on which the data refreshes daily and everyday you have one new day of data added. The end user would want to see a dashboard which would allow him to select the last N days and along with that he would like to have a filter for the days that correspond to the last N days. SO if he selects the last N days as 7, the filter should show the date range for the last seven days.
Well this is easy , we will have to create a parameter that allows us to select the last N days and then add a filter for the date range which uses the parameter. However this has one basic issue , the next day when you data gets added to the report the filters do not automatically update.
The trick to update the filter range automatically is to use a calculated feild .
Follow these three steps to do it.
1- Create a parameter to select the last N days to display on the filter range.

1

 

2- Create a calculated field as under

2

Step3: Place the calculated field ‘Range of Last N Days’ to the filters mark and select true. Add this filter to context. Now bring the date field to the filters and select show values in context for this filter.

That’s all.
Now with everyday refresh of the data , the date filter would update automatically.
Hope you guys use it in your dashboard going forward.

Please follow and like us: