With Tableau Server you can filter your Tableau dashboard using the URL. To filter the Tableau dashboard pass URL parameters into the URL.
A URL parameter isn’t the same as a Tableau parameter. Look at some of the URLs in your browser. You may notice some have a question mark (?) in the middle. Everything after the ? in the URL is a parameter. There can be multiple parameters – these are all separated by an ampersand (&). These URL parameters provide a way of querying the database behind the website. For example if using a search box on any website check the URL after the search. It’s very likely the search text will appear after the question mark of the URL.
Passing Tableau filter values in the URL is simple. It is detailed in this post on the Tableau Forums.
In summary get the URL to access the dashboard on Tableau server. To add URL parameters add a question mark at the end of the URL. After the “?” put:
- the name of the Tableau field being filtered (case sensitive)
- next the equals (=) sign
- finally the filter value (also case sensitive)
The Tableau field can be a dimension, measure or Tableau parameter.
For example you have a Tableau field or Tableau parameter named EmailAddress and it is on the filter shelf of your dashboard worksheets.
How to alter the URL
Consider we have a field called [email address] and a field called [ReportYear]. Notice the space between “email” and “address”. Spaces and other special characters don’t pass in a URL, therefore they must be encoded. A space within a URL alters to %20. Therefore email address within the the URL will be email%20address.
The base URL of our dashboard is:
Standard single field / single value filter
To filter the field [email address] by the URL enter the URL parameters be as follows (with the URL parameters in bold):
URL to filter a single field for multiple values
To filter for multiple values use a comma (,). For example to filter for 2 email address values alter the URL as follows:
email address = firstname.lastname@example.org OR email@example.com
URL to filter multiple fields
To add additional parameters add an ampersand (&) to separate the fields. For example the following filters for:
email address = firstname.lastname@example.org AND ReportYear = 2012
URL to filter multiple fields for multiple values
Combining the above, use the following to filter for:
(email address = email@example.com OR firstname.lastname@example.org) AND (ReportYear = 2012 OR 2013)
URL to filter multiple fields – Exclusive Filtering
In fact, URL filters are actually more flexible than standard drop down filters. For example consider the case where you want:
(email address = email@example.com AND ReportYear = 2013) OR (email address = firstname.lastname@example.org AND ReportYear = 2012)
Filtering by the URL gives an option Tableau call Exclusive Filtering. Add
~s0 to the field name to make it Exclusive.
The following URL will filter the above criteria:
Another useful thing; the filter field does not need to be visible on the dashboard. However the filter field does need to be on the filter shelf of your dashboard worksheets.
A final point about filtering a Tableau parameter by URL
A Tableau parameter is made of two values:
- the Value
- Display As
By default the Display As value is expected in the URL. However it is also possible to use the Value. If passing the Value in the URL use a special character to notify Tableau. In the URL add
~na after the parameter name
Take the following where we have a parameter called UpOrDown. The user is able to choose either Up or Down.
To choose “Down” by URL, Tableau expects the Display As value by default. Therefore the URL is:
However we can also pass in the actual value, making use of
Obviously this can also combine with the field filters using ampsersand (&).