Managing Dashboard Date Filters

Authors:
Share:

Published By: Robert Rotzin

It is essential, in any dashboard build, to decide how to handle dates. How dates are formatted, displayed, and aggregated determines the charts that will be used, the comparisons that are involved, and the interpretation by end users. As developers, we must strike a balance between providing users with flexibility and guiding them directly to the most useful or requested analyses.

In a recent public health surveillance project, we encountered this exact issue. Our users appreciated our idea of offering a selection of curated views called “Quick Reports,” which included pre-filtered dates and display types. However, users also wanted a way to adjust each filter individually, if desired. Building out each option by itself is straightforward. A parameter could help list predetermined date options, such as the last 7 days, and a date field itself could provide a flexible date range filter. The challenge was to integrate both features so that they work together and our users receive the desired functionality.

Figure 1 below shows a default view (top) for users that combines a date range (past 24 hours or past 7 days) with a map type, either an area or a heatmap. A second view (bottom) has a date range filter, map type selection, and a few other choices. Dynamic Zone Visibility (DZV) is used to swap out the appropriate parameters and filters for a seamless user experience.

Figure 1: Two views showing dynamic options for users to select from, including a curated set of date ranges (top) or a flexible date range (bottom).

To accomplish the flexible date range requirement, we had two options: build our start and end date dynamic parameters or use a continuous date filter. Both methods require taking advantage of different Tableau features you may not have noticed or used before. In this post, I’ll review each option, the one we selected for the project, and, most importantly, how to integrate them with the “Quick Report” options.

For additional context, the “Quick Reports” list option is a simple integer parameter used to control other calculations that govern the date range and map type shown on our dashboard. For this project, we wanted to offer two date ranges and two map types, resulting in four options: the past 24 hours by area, the past 7 days by area, the past 24 hours by heatmap, and the past 7 days by heatmap.

The image below shows a detailed view of the “p.Quick Report Options” parameter, which controls calculations that determine the date range and map type displayed on the dashboard.

Figure 2: View of the Quick Report Options parameter

The drop-down menu to select between our “Quick Reports” and “Filters” is a Boolean parameter. It’s used in two of the calculations shown later in the post. While a Boolean is used in this build, we could use an integer parameter to select between more than two options.

Figure 3: The parameter that controls the selection of “Quick Reports” or “Filters.”

Option 1:  Start Date & End Date Dynamic Parameters

First, let’s cover the Start and End Date parameters option (Figure 5). We don’t want to create just two date parameters that allow all values and leave it at that. By using Tableau’s Dynamic Parameter options, which were introduced in version 2020.1, we can set up a range of allowable values, so users won’t unintentionally be misled into thinking we have data for a date range that we do not have. We can also set the starting value for each parameter, ensuring a seamless transition from “Quick Reports” to “Filters.”

Changing the allowable values is easy. First, select “range” from the list and then select the date field from the “when workbook opens” option. This is important to make sure the range updates in tandem with our data. Next, we can set the “value when workbook opens.” For our End Date parameter, that will be our max date in our data source. For our start date, since the default view for users is set to the past 7 days, we will match that start.

One caveat is that the value must come from a table-scoped LOD so that it’s one consistent value; if your calculation isn’t showing up in the list, make sure the whole calculation is within the LOD. Here are the calculations I used for the max date and the 7-day start.

Figure 4: A table-scoped Max Date LOD
Figure 5: Date range calculation uses an LOD so it becomes available in our parameter settings

Make sure when writing out your calculations for the dynamic starting value that the entire calculation is wrapped in the LOD expression (see Figure 5 above). Otherwise, you won’t find it in your drop-down list when setting up the parameter. The same premise holds when writing table-scoped LODs for DZV.

Once we have those calculations created, we can make our Start Date and End Date parameters by creating a date parameter for each and choosing the appropriate calculation as the “Value when workbook opens” reference (Figure 6).

Figure 6: The Start Date parameter set up, which is similar to the End Date, except for a different calculation in the “Value when workbook opens” selection.

The last step is to make the Quick Reports and Date parameters work together in a single calculation that we can put on the filter shelf of our worksheets. The calculation (Figure 7) returns TRUE for the rows in our date range and FALSE for those outside. If we had more than two date options, a nested CASE statement could easily replace the IIF statement.

Figure 7: The calculation used as a filter on our worksheets, which changes values based on our parameters.

Option 2: Continuous Date Filter

Next, let’s look at our continuous date filter option. Before we put anything on our filter shelf, we first need to create a new date calculation that works with our Quick Reports parameter. The calculation will use the “Demo Date” date field from our data source (Figure 8). When we use our Filter List option, we return the date field; however, we return null when using our Quick Reports.

Figure 8: Calculation used as a filter for the continuous date option.

Unlike our Start and End Date parameters, we can’t get this date field to work with our Quick Reports in one calculation. We need to use one field to filter our Quick Report options or return TRUE when using our Filter List with the continuous date filter field above (Figure 9).

Figure 9: Date filter calculation example.

Very similar to the equivalent field with our parameter option, the ELSE statement, shown in Figure 9 above, is simplified to return TRUE, thereby not limiting any rows of our data. Our full filter shelf is depicted in Figure 10 below.

Figure 10: Notice that we have both our Quick Reports date filter and our continuous date filter on the shelf.

To ensure our continuous date filter doesn’t conflict with our Quick Reports date filter, we must include null values in our date range selection. There’s an option in the lower right corner of our filter setup that makes all the difference. The checkbox is located above the Cancel and OK buttons. Without checking this box, our continuous date filter would always block our Quick Reports from working.

Figure 11: The checkbox required in the continuous date filter calculation that allows the Quick Reports to work correctly.

In the example below, we can see in the top section that the two date fields, “Demo Date” and “Date Filter – Continuous Dates,” are shown next to the “Date Filter – All Report Options” field, which is controlled by our report options. When “Quick Reports” is selected, the date filter essentially becomes a non-factor if null values are included.

However, when null values are omitted, the filter stops any data from flowing to the worksheet, and no table is generated (lower image). Tableau’s default setting is not to include null values (the checkbox isn’t checked), which Tableau refers to as just “Values in Range.”

Figure 12: Example table showing how when null values are included the table (worksheet) is still displayed vs. when null values are not included, which results in no data valid data and no table.

Selecting a Method

To our dashboard users, both options look nearly identical. So, which option should you use?

Let’s compare the benefits of each method. The Start Date and End Date parameters have a more streamlined setup with just one field on the filter shelf. We can also take full advantage of dynamic parameters to set the custom start date. With the continuous date filter, it updates automatically if we use the full range. However, if we limit the range, it retains that range until we change it and republish our workbook.

A drawback of the parameters is that they are truly separate, allowing users to create impossible ranges. This issue doesn’t occur with the continuous date filter. If you have an end date of 5/23/2025 and change the start date to 5/30/2025 (with the end date preceding the start date), Tableau will automatically adjust them to a logical range for you. This minor feature ultimately became the deciding factor for this project. Our users appreciated not having to worry about impossible date ranges and found it just useful enough to tip the scales.

Both start and end date parameters, as well as continuous date filters, are good options. Our users can jump right to their most requested views with Quick Reports or switch to full flexibility and a complete filter list with a single click.

 

Contact our Experts

 

 

Robert Rotzin
Robert Rotzin
Robert comes to Sellers Dorsey from HealthDataViz, where he served as a consultant and technical trainer. There, he would engage with clients to design and build data dashboards, implementing user testing, quality assurance testing, and documentation. He also taught the Tableau system to both beginner and advanced users. While with HealthDataViz, Robert worked with the Children’s Hospital of Philadelphia on their New Jersey Safety & Health Outcomes Center for Integrated Data; utilizing their groundbreaking data warehouse to develop public facing dashboards around traffic safety events and outcomes among New Jersey drivers. Before joining HealthDataViz, Robert worked with the Virginia Department of Health as a Population Health Data Lead. There, he worked with program managers and epidemiologists to improve reporting and project outputs.

Current Responsibility

Robert guides clients in analyzing and visualizing their data in new and creative ways to improve the work they do. He brings his passion for helping clients understand how their data can be used to achieve their goals to the Firm’s clients.

Education

      • University of Virginia, BA; MPH

More Insights

Blog
Medicaid in Child Welfare for Health Plans
The Role of Medicaid in Child Welfare: How Health Plans Can Bridge Gaps and Improve Outcomes
Read More
News & Media
Dignifi Health
Sellers Dorsey Acquires DignifiHealth
Read More
CMS Special Coverage
CMS Proposed Tax Rule Summary
New Summary: Medicaid-Related Provisions in the Congress-Passed Budget Reconciliation Bill
Read More
Webinars
Implications of H.R. 1 – OBBBA: What it Means for You and How to Move Forward
Implications of H.R. 1 – OBBBA: What it Means for You and How to Move Forward
Read More