Dynamically Set Default Values for Quick Filters in Tableau

Recently, I was helping someone with a Tableau dashboard in which an action from the first view filtered a second view.  The second view additionally had a quick filter and that quick filter set to show only relevant values.  Something like this:

But, try setting the drop down quick filter option to “Medium” and then select “Express Air”.  Notice that “Medium” never occurs with “Express Air”.  The result is all data filtered, a blank view, and the drop down filter shows “(Medium)” – it’s in parentheses to let you know that the filter value isn’t relevant.

And, I can confirm that with a quick view:

Confirmation

Indeed, not all ship modes use all priorities.

Now, the question arose: Can we get the quick filter to default to a certain value based on the Ship Mode selected?  That is, can we set a default value for a quick filter based on an action?

Don’t be too quick to say, “No!”  That was my first inclination.  But I was wrong… There is a way!

And I’ll tell you next time…

 

 

ha!

 

 

 

 

…Just kidding!  I’ll tell you now:

 

Setting Default Values for Quick Filters

Let’s say I identify the following values that I want for the defaults of the quick filter drop down based on my selection:

desired default values

Here are the steps I took:

  1. Create a field that gives me the default order priority for each Ship Mode. I could do this in the source.  I chose to do this as a row-level calculation.  It’s important that it’s row level and not aggregate, because I’ll need to eh field to be classified as a dimension (so no blending for the default either).

Calculated field to set default for each Ship Mode

  1. Make sure the field is in the view that will trigger the action. Here, I’ve just added it to the detail of the Marks card:

Add to Detail

 

  1. Then I create a new, separate action in the dashboard that maps Default Order Priority from the source sheet to the Order Priority field of the data source for the target:

Action Filter Options

Notice that I’ve specified the Target Filters to specifically map the Default Order Priority to the Order Priority.

 

After triggering the actions on the dashboard, you can look at the target view sheet and see that the Actions are applied as filters:

Action Filters in the View

 

So, the final trick to dynamically set and change the quick filter value is to use the Action filter as a quick filter instead of the original field.

To do this, locate the little drop down caret and use the menu to add the quick filter for the Action:

The little drop down caret

And now, you have a dynamic quick filter with default values based on the selection!  Experiment below:

 

 

Related Posts

19 thoughts on “Dynamically Set Default Values for Quick Filters in Tableau

    1. Hmm… I’m not seeing it. I’ll let you know if I do (or let me know if you keep seeing it).

  1. You might be able to use an LOD calc like so:
    { fixed [Ship Mode] : MIN([Order Priority]) }
    to dynamically chose the ‘default’ rather than having it be a hard coded CASE WHEN calculation.

    1. Yes, that would be really cool. You could even use LODs to determine the Order Priority with the most or least number of orders (or highest or lowest profit). It would be something like this.

    1. Yes! You can use a parameter instead of hard-coding 12. That way the user can select how many to show.

  2. This is great. Thank you so much. I was able to select the defaults I wanted.
    Would it be possible to adjust the quick filter option list based on the category chosen? Basically, each category in my project has three or four options associated with it, and I only want the relevant ones to show.
    While I could get this dynamic filter list to work before, I end up breaking that ability when I apply your method. Any adjustments you’d recommend?

    1. Hmmm… I’m not sure right off. Would it be possible to post the workbook on the Tableau forums with your question? Ping me and I’d be happy to take a look.

  3. is there a way to do this without action filters?

    We develop dashboard for one client and then copy it across different clients. If the value in default filter is not present for a particular client, the dashboard goes blank. We have manually select a different value in quick filter before publishing it for that client.
    if there is way to automate this, it would save a lot of time and manual effort.

    1. The action filters are the only way I’ve come up with so far. I’ll definitely have another post if I find another! Or maybe someone else knows?

  4. Thanks for the solution here. However, I got a question for you about the filter. How people can select the rest of the option under each Ship Mode? For instance, the default value for Regular Air is Critical, how user selects the rest of the order priority in the filter? I tried your method and for some reason I see only Critical under Regular Air because of the CASE statement I think. Thank you.

  5. I wanted to default a dynamic filter with max of all values however this does not seem to be working with above approach. Currently we have all values as default which pulls a huge chunk of data from multiple partitions. we wanted it to be default to max of the field so that we can restrict data on first load. after that user should be able to select any value from filter.

    Is there any other way to implement it?

  6. Is there a way to filter the dashboard from another dashboard itself? like passing values in the url similar to how some search engines pass values? something like

    Tableau/?&filter=region1

Leave a Reply

Your email address will not be published. Required fields are marked *