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:
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…
…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:
Here are the steps I took:
- 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).
- 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:
- 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:
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:
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:
And now, you have a dynamic quick filter with default values based on the selection! Experiment below:
Hi Joshua,
Great article as always. I’m noticing that you are getting an error on the blog page from the server: https://drive.google.com/file/d/0B0k64Ucxl99-S3UzZTM0RHdXa3c/view?usp=sharing
If this is a Tableau bug, I’d be very interested in following up.
MAK
Hmm… I’m not seeing it. I’ll let you know if I do (or let me know if you keep seeing it).
So cool; thanks for sharing Joshua!
Your welcom, Matt!
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.
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.
Thanks for sharing as I was looking for something similar, I applied your approach but it didn’t work for my scenario.(your approach works otherwise).
I did post my question in tableau forum hoping for some answers. (https://community.tableau.com/thread/196407)
Hi Josh! Great solution! Is there a way to only include only relevant values here as well as having the default?
Is it possible to show top 12 values in a filter by default and the users can pick more than 12?
Yes! You can use a parameter instead of hard-coding 12. That way the user can select how many to show.
Very useful. You saved my day. Thanks Joshua
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?
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.
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.
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?
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.
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?
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
Found a way to pass parameters in the Tableau dashboard URL to filter the view directly
https://onlinehelp.tableau.com/current/pro/desktop/en-us/embed_structure.htm
But the problem is this causes issues when the value to be filtered is a single select, but has a comma. Any suggestions for a fix?
https://stackoverflow.com/questions/57094463/tableau-url-parameter-with-comma