Tableau Server Passing Parameters in the URL

//

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.

How to filter Tableau using 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 of 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 the field can be a dimension, measure or Tableau parameter.

For example, there’s a Tableau field or Tableau parameter named EmailAddress, and it is on the filter shelf of your dashboard worksheets.

How to alter the Tableau Server URL to filter

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:
http://ServerName/views/WorkbookName/ViewName

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):

http://ServerName/views/WorkbookName/ViewName?email%[email protected]

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 = [email protected] OR [email protected]

The URL is:

http://ServerName/views/WorkbookName/ViewName?email%[email protected],[email protected]

URL to filter multiple fields

To add additional parameters add an ampersand (&) to separate the fields. For example the following filters for:

email address = [email protected] AND ReportYear = 2012

The URL is:

http://ServerName/views/WorkbookName/ViewName?email%[email protected]&ReportYear=2012

URL to filter multiple fields for multiple values

Combining the above, use the following to filter for:

(email address = [email protected] OR [email protected]) AND (ReportYear = 2012 OR 2013)

The URL is:

http://ServerName/views/WorkbookName/ViewName?email%[email protected],[email protected]&ReportYear=2012,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 protected] AND ReportYear = 2013) OR (email address = [email protected] 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:

http://ServerName/views/WorkbookName/ViewName?email%[email protected],[email protected]&ReportYear~s0=2013,2012

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.

Filtering a Tableau parameter by URL

A Tableau parameter is made of two values:

  1. the Value
  2. 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.

Tableau Integer Parameter Display Text

To choose “Down” by URL, Tableau expects the Display As value by default. Therefore the URL is:

http://ServerName/views/WorkbookName/ViewName?UpOrDown=Down

However, we can also pass in the actual value, making use of ~na:

http://ServerName/views/WorkbookName/ViewName?UpOrDown~na=2

Obviously this can also combine with the field filters using ampsersand (&).

Filter Tableau URL using a Wildcard

Do you want to filter your Tableau dashboard using a wildcard in the URL? A wildcard is similar to a LIKE statement in some programming languages.

Tableau does support wildcard filters, it’s actually a type of filter. However, these filters don’t work in the URL. URL parameters don’t support wildcard filters.

Fortunately, as with many things Tableau, there is a workaround.

How do I pass a wildcard parameter in the Tableau URL?

To solve this problem, some work is also necessary within the Tableau workbook.

An alternative to a wildcard filter is to use a parameter. String parameters can accept any values and a calculated field can use those values to simulate a wildcard filter.

Create a String parameter with a date type of String. I have set up a simple example using the sample superstore to wildcard filter the Customer Name.

The settings of a Tableau string parameter to use as a wildcard
String parameter as a wildcard filter

A calculated field, using the CONTAINS function, can pick up this value and convert it to a wildcard.

CONTAINS(UPPER([Customer Name]),UPPER([PrmCustName]))

This converts all values to upper case, then checks if the string entered in the parameter is in the data.

It returns True when it matches a value. Therefore, put this calculated to the Filter shelf and set to True.

Passing the Tableau wildcard value as a URL parameter

Remember Tableau parameters do work in URL parameters. To pass the parameter value, the same as earlier examples, append the following to the end of the URL:

?ParameterName=WildcardValue

For example, this URL filters for all customer names containing “son”.

https://public.tableau.com/profile/andrewwatson#!/vizhome/FilterURLWildcard/WildcardFilterByUrlParameter?PrmCustName=son

(Note: Periodically Tableau alter their Tableau Public URLs. If the link ceases to work properly please mention in the comments so we can update it.)

Notice the end of the URL, that is where I have put the wildcard value. Copy the URL and change “son” to another value and see what happens.

You should have a functioning Tableau wildcard filter that also filters using a URL parameter!

19 thoughts on “Tableau Server Passing Parameters in the URL”

  1. Hi,
    I am using parameters with a URL, all works great BUT the parameters impact all the sheets in my target dashboard, even if the parameter field is not being used at all in some sheets.
    Example:
    I have a filter “week”, to a target dashboard that shows the revenue of that week and there is a trend bar chart that does not even use that field week and still is impacted by that filter.
    Any idea of what is happening? is it a Tableau limitation?

    Reply
    • I think you might have stumbled across a quirk of Tableau. When you move to a different dashboard does the parameter remain on the URL?

      Reply
    • You can using a Tableau parameter instead of a true wildcard filter. I have updated the post describing this method.

      Reply
  2. hello how can i apply relative date and date range in url parameters ,For me its not working please help

    Reply
  3. Hi,
    i am trying to export a dashboard with filter value in, url query param when i try with simple query param (?first name=ruksad,sam) it works but when i try with all value in query parama(?first name=all) it does not work, any help in this will be much appreciated thanks in advance

    Reply
    • As far as I know, you have 2 options.
      1. add literally all possible values as a long comma separated string (this may not be practically possible in many cases)
      2. Remove the reference to this filter in the URL, which by default will then select all

      Reply
  4. Hi, I have question/issue on parameter via URL.
    I have created parameter on userid and manually added ‘all’ value in parameter and created filter calculation to show values of userid or ‘all’ values. I uploaded dashboard with ‘all’ selected for the userid parameter.
    This works in server when i pass userid=1234567 for particular user and it also works when i donot pass userid to show ‘all’ values.
    ISSUE is while navigation to another dashboard in same workbook. While navigating, i send current client number to next dashboard along with url userid. But rest of ‘client number’ on 2nd dashboard is resetting user-id as well, and so unwanted data is shown on dashboard which does not belog to userid.
    can you please advise, whats going wrong? (i have dshboard action on user id filter calculation to ‘keep filter’ on clearing)

    Reply
  5. I don’t want to show the header on my viz (the one with the path, favorites/help/notifications icons…). Is it possible?

    Reply
  6. When trying to filter a Date parameter, the format received is mm/dd/yy but the display is dd-mmm-yyyy, the filters are not applied

    Reply

Leave a Comment