Welcome to new things

[Technical] [Electronic work] [Gadget] [Game] memo writing

How to use "relative date" and "date range" at the same time in Tableau

PS

Now there is another, better way, which is shown below.

www.ekwbtblog.com


To the UI for specifying the display range of time series graphs

The default is to show the most recent X days, and you can specify any date in the calendar when you need it."

I often see things like this.

But I can't do the equivalent with Tableau's date filter.

The "Show Last X Days" allows you to set the date filter to "Relative Date". The "Any date" can be set to "Range of dates".

Unfortunately, however, it is not possible to have "relative dates" and "date ranges" at the same time.

There are quite a few requests for this date filter that can be relative and absolute, so I was wondering if there was any way to make it work, and I found the following article.

kb.tableau.com

The article is about how to create a relative filter that can dynamically set the anchor date, but I applied this to create a date filter that can be both relative and absolute.

procedure

Create date selection method

Create a parameter like the image below. How to use "relative date" and "date range" simultaneously in Tableau

Create start and end dates

Create the parameters as shown in the image below. Create "End Date" in the same way. How to use "relative date" and "date range" simultaneously in Tableau.

Creating a Date Range

Create a calculated field as shown in the image below. How to use "relative date" and "date range" simultaneously in Tableau.

Filter date ranges

The key is the calculation field created above, which is TRUE for the intended date, and by putting it in the filter, you indirectly create a "date filter that can be both relative and absolute".

relative date

How to use "relative date" and "date range" simultaneously in Tableau

absolute addressing

How to use "relative date" and "date range" simultaneously in Tableau

Impressions, etc.

Date-specific UIs that can be both relative and absolute are quite common, so it would be very useful to have them as a default feature.

In the example, the relative time range is fixed at 30 days, but if you want to make it variable, you can do so by parameterizing it.

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com