ez4nick
ez4nick

Reputation: 10209

Have Max value of range of dates filter be todays date

I have a "Range of Dates" filter and what I want is for the max (or right most value) to always be the most recent date which should be today's date. What seems to be happening is that if I leave the dashboard open and come back the next day the max value is yesterday's date and I must manually move the slider over to be today's date. How can I accomplish this?

Upvotes: 0

Views: 2446

Answers (2)

Jake Losh
Jake Losh

Reputation: 76

I've generally seen two basic approaches for this problem: Calculated fields and relative dates.

  1. Use a calculated field or parameter or some combination of calculated fields and parameters with filters. This is similar to what smb suggests in their answer to this question. It also seems to be the most popular approach.
  2. If you don't particularly care about being able to set the end-date with the slider, you could try using relative dates, using the approaches detailed in the accepted answer to this Tableau forum question and in this Tableau Knowledge Base article. Jennifer Vonhagel also gives a second answer to the Tableau forum question farther down that uses a parameter plus calculated field approach.

Additionally, this Tableau Knowledge Base article offers another option (Option 1, in the article) if you have Tableau 10.3+: You can use the "Latest Date Preset" (see here for details) check box in the date filter dialog box. I haven't used this, but it looks promising if you're using Tableau Desktop (seems like it wouldn't work for Tableau Web). The article's Options 2-4 are just riffs on calculated fields, in my opinion.

Two more approaches I've heard of – but never personally seen in the wild:

  1. Push the max date down into the view you put Tableau on top of and let the view do the work.
  2. Use a script to modify the Tableau workbook's XML.

Upvotes: 1

smb
smb

Reputation: 673

I find a calculated field is the best way to do this as I have run into the same issues using the out of the box max date filter.

Create a calculated field as follows:

[date] =  {FIXED: max([date])} 

This creates a True False field where only the records that have the max data and carried through.

Now drag this onto the filter pane and select 'TRUE'.

Upvotes: 1

Related Questions