Online tableau training, tableau tips, & video tutorials
How to Pass Filters and/or Parameters Between Tableau WorkbooksPreview
Make user selections stick when navigating between reports
Ryan shows you how to add query strings to URL dashboard actions so that user selections in filters and/or parameters persist when a user navigates between workbooks on Tableau Public, Tableau Online, or Tableau Server.
Hi, this is Ryan with Playfair Data TV, and in this video, I’m going to show you how to pass filters and/or parameters through different workbooks. This is a great way to improve the user experience any time you’re trying to navigate your end users between different files that reside on either Tableau Public, Tableau Online, or Tableau Server.
The reason this is relevant for you is if you’ve got two separate workbooks in an enterprise environment that might live on Tableau Online or Tableau Server, if the end user changes the settings in one of those workbooks, but then tries to open a second workbook, that second workbook will not remember their selections in the first workbook. That’s exactly what I’m going to show you how to do here with this technique.
We’re going to set this up so that our end user can change the settings of a filter or parameter in one workbook, and then navigate to a second workbook, and those settings are going to stick so they don’t have to reset them.
To illustrate how to do this, we’re going to be using the Super Sample Superstore dashboard that you see here on the screen. I want to point out that the default settings when I uploaded this workbook to Tableau Public were a start date of September 2016 and an end date of March 2017.
And if I open that in a Google Chrome browser, you will see the same thing. Start date of 9/1/2016. End date, 3/31/2017. Those were the default settings when I uploaded this.
If I change the settings in one place, so let’s just throw out a fake use case here. We’ll say the quarter’s turned over, and we want to bump both of these date ranges up three months.
I’ll change the 9 to a 12 and the 3 to a 6. Bump up the date range.
If I go back to Tableau Public, obviously, it did not overwrite those default settings. It’s still the original, 9/1/2016 to 3/31/2017.
But what we’re going to do is setup a way that passes that change that I just made to the version that lives in Tableau Public, so in that browser window.
The first thing that I do if I’m ever trying to pass filters and/or parameters is to take note of exactly how the field that I’m trying to pass is spelled. You can do that by going to any sheet. And remember, what we’re trying to pass in this first example is the setting for the start date and end date.
So I’ll go to any sheet. And I happen to know that those two date settings are not actually dates. They are parameters. And those parameters are called Minimum Date and Maximum Date.
So I’m just going to take note of that, because this is going to be very important later on when we tell Tableau which settings to pass between our two different workbooks. So a parameter called Minimum Date. A parameter called Maximum Date. Got it.
Now I’m going to go back to my dashboard. And the trick to getting this to work involves setting up a Tableau dashboard action, which you can do by clicking Dashboard in the top navigation, and clicking Actions.
I’m going to click Add Action. And you’ll see that there are five different types of dashboard actions. If this is new to you, I encourage you to watch the video An Introduction to Tableau Dashboard Actions here at Playfair Data TV.
But the one that we are adding in this case is called a URL dashboard action. It’s this third option, Go to URL. So I’m going to click on that.
And I’ll call this my Passing Filters or Parameters Example. I’ll leave all the defaults in place for now. This just means that this URL action is available on any of the sheets on the dashboard. And it will run on Menu. That’s the default. What that does is when you hover over a sheet, this URL action will appear as an option within the tooltip.
So obviously, you can customize this how ever you want, but I’m going to leave the defaults for now.
A piece that I do need to fill in here, though, is the destination URL. We are going to navigate our end user to this Tableau Public visualization. So I’m going to go copy the URL for this dashboard, which you can do by clicking on this share link at the bottom of a Tableau Public viz, and just copying this back over to our URL dashboard action. So I just literally copied and pasted that.
There’s a little bit of extra code that I don’t necessarily need, things like the embed, the display count. I’m going to go ahead and delete that part of the URL.
The trick to passing filters and parameters between Tableau Public, Tableau Online, or Tableau Server Workbooks is to add a query string to a URL dashboard action. We’ve already pasted the destination URL into this box, but we want to give Tableau more information on which pieces of this data to pass to the destination URL.
A query string always starts with either a question sign or an ampersand. The difference depends on whether or not there is already a question mark within your URL. If there’s already a question mark, the query string starts with an ampersand or an ‘and’ sign. If there’s no question mark, the first piece of the query string always starts with a question mark.
So I typed in a question mark. What comes next is the name of the field that you are passing. We are passing Minimum Date and Maximum Date. So let’s start with Minimum Date. I’m just going to type in Minimum Date. And this is why it is so critical to know exactly how those fields are spelled, because it’s case sensitive. It’s typo sensitive. If you’ve got spaces, all that stuff makes a difference. It has to be spelled exactly the same.
If you’ve got a space that’s part of a URL, you need to replace that empty space with a plus sign. That’ll help the URL fill in correctly. So if you see a space, just add a plus sign instead.
So question mark Minimum plus Date equals, and then what comes next is the parameter itself enclosed in triangular brackets. So open triangular bracket.
This is a parameter. So I’m passing the word Parameters to differentiate what exactly I’m passing. It’s a parameter called Minimum Date. And then close triangular bracket.
Notice this second piece of the query string also contains a space, but because that space is within these brackets, I don’t need to replace it with a plus sign. It’s going to work just fine. So there’s the first thing we’re passing.
If you ever want to pass more than one thing, you start each thing you’re trying to pass with another ampersand. So for this first example, we’ll just pass two things, the Minimum Date and the Maximum Date.
Because this is the second piece of my query string, I’m going to start it with an ampersand or an ‘and’ sign. And it’s very similar code to the Minimum Date, but it’s the Maximum Date instead.
So Maximum Date equals open bracket Parameters.Maximum Date close bracket.
You can test this link before you accept it. Let’s take a look to see if this is working.
Remember, when I published this Tableau Public visualization, it was defaulting to September to March. We’ve since changed that. We’ve pushed our date range forward one quarter. So I’m hoping that this destination gets overwritten with our new selections, 12/1/2016 to 6/30/2017.
Let’s take a look. If I click Test Link, this will open in a new browser. I can tell while it’s loading that it’s passing this query string. Look up here in the top of the browser window. So that’s not there by default. That’s what we just coded as part of this URL dashboard action.
And now if we look within the viz, it’s not loaded with the defaults. Remember, the default was September to March. It overwrote those parameters with December to June.
Now that I know it’s working, I’ll go ahead and click OK. Click OK to close that.
And because we set this up to run on Menu on any sheet, if I were to click on a data point, we will see that URL appear.
So I do want to point this out. The URL action is literally the name that you coded. So if you’re using it to run on Menu, what I encourage you to do is name the dashboard action some type of call to action. I might say something like, “click here to open the deeper dive dashboard with these same date settings”.
And if you click on that, it opens in a new browser. Again, the query string carries over. And those parameters get overwritten.
Just a couple more things that I want to point out about this technique. I’m using Tableau Public as my example, because this is publicly available data. And Tableau Public is actually the world’s largest installation of Tableau Server.
But I want to point that out because this same functionality will work within your organization, whether you’re using Tableau Public, Tableau Online, or Tableau Server. I just happen to be looking at this within a Tableau Public example.
Also, I want to point out that filters work the exact same way as passing parameters. So we just passed two different parameters, but if you wanted to do something similar to pass, say, the Region dimension, you could do the same thing within a query string.
This has been Ryan with Playfair Data TV – thanks for watching!
Related video: An Introduction to Tableau Dashboard Actions
Related video: An Introduction to Tableau Parameters
Related video: Four Types of Filters in Tableau
Related video: Four Types of Analytics in Tableau
Related blog post: Tableau UI Tip – How to Pass Filters and Parameters Between Workbooks
- An Introduction to Level of Detail Expressions
- How to Use LOD Expressions to Create Benchmarks
- Exercise: Use LODs to Compare Sales to a Benchmark
- How to Normalize Current Dates and Prior Dates on One Axis in Tableau
- Using Tableau’s Parameter Actions Extension to Change Date Parts
- Two Ways to Dynamically Display the Top N vs Other in Tableau
- How to Pass Filters and/or Parameters Between Tableau Workbooks
- How to Automatically Highlight Highs and Lows in Tableau