Data Viz Done Right

November 1, 2012

Tableau Tip: Passing filters in a URL (to create a dynamic report in PowerPoint)

50 comments
Monday I showed how to embed an image of a Tableau Dashboard in PowerPoint that updates dynamically.

This process can actually have a much broader use if you customize the URL to include filters.  Let’s look at an example.

Assume you’ve created this sales dashboard.

Notice that there are a few filter options on the right. Your goal is to build a PowerPoint for your regional sales teams, but you don’t want them to see each other’s information. You have a couple of options:

  1. Create a separate dashboard for each region. Terrible idea! Way too many charts to maintain.
  2. Add user level security. This is easy to do with Tableau Server, but there are lots of companies that can’t afford Tableau Server. So that option could be out the window.
  3. Create filtered URLs and embed those in the PowerPoint via the instructions from Monday.

The link for the image for the whole dashboard is https://[YourTableauServerURL]/views/OneMinuteDashboard/OneMinuteDashboard.png.  And the resulting image looks like this:


If you want a page for the Central team, you simply add ?Region=Central to the end of the URL if you are using Tableau Server. The URL now looks like this:

https://[YourTableauServerURL]/views/OneMinuteDashboard/OneMinuteDashboard.png&Region=Central



Notice how the Region is filtered to Central.  You could embed this into PowerPoint, then duplicate the PowerPoint file and change to image to the East, etc.


You can include as many filters as you want by adding an ampersand (&) then whatever else you want to filter.  The filter has to be in the format filter_name=value.

If I want a page for each Order Priority for Central, then all I do is add &Order Priority=Critical to the URL.  Then replace this with High, then Medium, etc.  In this example, the URL would now look like this:

https:/[YourTableauServerURL]/views/OneMinuteDashboard/OneMinuteDashboard&Region=Central&Order%20Priority=Critical

And the resulting image looks like this:


Do you need to show the quick filters using this technique?  No, but for me it makes the image more clear to the reader to do so.  You could remove the quick filters and have the title update based on the filters.  That would look good.

Finally, if you want to include multiple selections from a filter, perhaps Critical and High, then you simply add ,High to the URL.

https://[YourTableauServerURL]/views/OneMinuteDashboard/OneMinuteDashboard.png?Region=Central&Order%20Priority=Critical,High

The image now looks like this:


The filtering options are pretty endless.  All you need to remember is the format for adding a filter to a URL:
?filter_name=value
I’ve created a PowerPoint with a page for each region here.

50 comments :

  1. Very useful information. Thanks!

    ReplyDelete
  2. Hi Can we pass list of values as the params passed there like list of Regions

    ReplyDelete
    Replies
    1. Yes, you can pass the parameters just like the regions.

      Delete
  3. Is it possible to pass parameters for "set" when they are set to filter on IN/OUT(setname)? I've been trying every combination of setname=IN or IN/OUT(setname)=In to no avail.

    ReplyDelete
    Replies
    1. As far as I know, sets cannot be used in calculations. You could create a case statement that acts the same as a set though.

      Delete
  4. is it possible to do this like wildcard filter? If so how?

    ReplyDelete
    Replies
    1. Jason, I've looked around and tried multiple scenarios and have not been able to figure out a way to pass wildcards.

      Delete
  5. Can we hide the Quick filter column in the dashboard .

    Scenario : I want to filter it by passing filter value in the url , But don't want to display the quick filter .

    Thanks

    ReplyDelete
    Replies
    1. You never have to show a quick filter to use it in a URL.

      Delete
  6. Is it possible to set a parameter to another parameter the user would select on the sheet. something like ?
    ?filter_name=[Parameter2]

    ReplyDelete
    Replies
    1. Tyler, you can't use parameters in filters, but if you create a calc field that captures the value of the parameter, then that should work.

      Delete
  7. I need to do a date filter in the URL such as ?MyDate>2014-01-01 is that possible?

    ReplyDelete
    Replies
    1. Tad, I haven't tried that, but I suspect you could do it by creating a calculated field like MINDATE = MIN([MyDate]) and then filter on that as a starting date filter. Then in the URL you would put MINDATE={the date}.

      Delete
  8. I'm using tabcmd to export a workbook as twbx from the server to a shared drive. The URL used for the argument of the get command is similar to that you've used to embed the image. I'm wondering if it's possible to pass similar filters to the URL so that the data of the resulted twbx is restricted by the filter specified in the URL. Thanks!

    ReplyDelete
    Replies
    1. I don't see any reason why that wouldn't work. Here's a KB article about URL filtering - http://kb.tableausoftware.com/articles/knowledgebase/view-filters-url

      Delete
    2. It works when I export a single view as pdf, png, etc., but doesn't when I export the entire workbook. I still see the whole data set in the packaged workbook. I'm not sure if I'm missing anything, but here's the tabcmd I'm using:
      tabcmd get "workbook/RevPerWafer.twbx?Technology=28NM" -f "C:\Users\TYEN\Documents\RevPerWafer.twbx"
      It runs fine (returns a "Succeeded" message and I'm able to open the workbook), but is not restricting the data.
      The following works and is filtering the data as desired, but the result is a static, single view instead of a workbook:
      tabcmd get "views/RevPerWafer/RevPerWafer.pdf?Technology=28NM" -f "C:\Users\TYEN\Documents\RevPerWafer.pdf"

      Any suggestions and guidance is much appreciated!

      Delete
    3. I'm not familiar enough with tabcmd to provide any advice there. I'd suggest you post on the Tableau Forums.

      Delete
  9. I am passing name of country using URL action to a dashboard, that dashboards is as a tab in a workbook. Now the user want the same country filter to remain applied when he navigate through different tabs.

    Please suggest a way to do this as I can see the # appended to the URL is causing the problem else it will work.
    http://tableau/v/fhrytu/views/BenchmarkDashboard/SEOPerformancedashboard?Country=US&:linktarget=_self#7
    so can we permanently remove #7 from above URL.

    Thanks.

    ReplyDelete
    Replies
    1. Sanjeet, I'm not sure when Tableau started including the hashes in their URLs. Either way though, you don't have to pass that to the URL.

      Delete
  10. How did you disable the "Edit" icon in the toolbar at the bottom?

    ReplyDelete
    Replies
    1. You can handle that through the URL parameters. Here's a list of all of the parameter options: http://onlinehelp.tableausoftware.com/v7.0/server/en-us/embed_list.htm.

      The one you will be interested in is the toolbar option. You should add toolbar=no to the URL. See the link above for the syntax.

      Delete
  11. Can we drill to another workbook like we do drill through in Cognos

    ReplyDelete
    Replies
    1. Arnab, you absolutely can. You simply pass the URL of the other workbook and can pass the filters along as well.

      Delete
    2. Hi Andy, I have a similar problem in that I have a "Home" page with a list of Regions and a "Mainpage" with a web page object using the url's of 3 other embedded dashboards. I need to be able to select a Region and have that filter value transfer to the Mainpage and all dashboards inside of that web page object. I can see in the address bar that it is changing but my view still shows all regions.
      URL action in Home
      http://tableau-na.com/views/MYDASHBOARD/MAINPAGE?Region=&:embed=yes&:toolbar=no
      Address bar after filter and navigation to Mainpage
      http://tableau-na.com/views/MYDASHBOARD/MAINPAGE?Region=West&:embed=yes&:toolbar=no

      I can get it to work outside of the url web page object but not inside of it. (Meaning it will open up a separate browser window not inside my Mainpage)

      Any tips on how I can get this to work?

      Thanks, this one is driving me crazy!

      Toni

      Delete
  12. Hello,

    I'm confused.
    When I type http://public.tableausoftware.com/views/OneMinuteDashboard/OneMinuteDashboard.png?Region=Central in my browser (firefox or chrome), the dashboard isn't filtered at all. Whatever I put after the question mark seems ignored.

    Did I forget to do something ?

    Thanks

    ReplyDelete
    Replies
    1. Yes, you need to include a : after the ?. Try this URL:

      http://public.tableausoftware.com/views/OneMinuteDashboard/OneMinuteDashboard.png?:Region=Central

      Delete
    2. Hi Andy,

      Actually i have doubt, As you mentioned above ,you have set the "Region = Central", Is there any possiblities to send the value dynamically. I have around 30 values in region field. Then how to do this?

      Delete
    3. Hi Andy,
      How can I pass filter values selected by user instead of hard code in the URL

      Delete
    4. Devi, did you search the forums or the help documentation? This should be answered there.

      Delete
  13. Andy,

    Hoping you can assist with this. I have two dashboard sheets with multiple viz's on each. A user will only see the landing dashboard I've set up then based on their date selections in one of the viz's will be navigated to the second detail sheet.

    I tried to implement a print icon with the URL assigned but can't quite figure out how to pass the date or dates selected from the first sheet into the URL needed in the second sheet. Hoping you might be able to help with this so I can include any date filter selections into the URL.

    ReplyDelete
    Replies
    1. Can you send a link to a packaged workbook that I can play with?

      Delete
    2. I am working on the same issue. We want a summary report on the 1st dashboard and the detailed report on the 2nd dashboard as well.
      What I did-
      I created a parameter to filter the device type... but I found out that parameter was not on the URL address. If I created a filter instead, the filter would show up on the URL address.Is it possible to put the parameter on the URL link?

      Delete
    3. Here's the comprehensive list of embed parameters - http://onlinehelp.tableau.com/current/server/en-us/help.htm#embed_list.htm

      Delete
  14. Yeah I put some together real quick which isn't proprietary...

    The gist is I'd like whatever filters chosen by the user in Dashboard 1 to be passed on into the URL image on Dashboard 2. This URL would then download a CSV file that is a predefined visual which is not surfaced in Dashboard 2.

    https://public.tableausoftware.com/views/Book1_1862/Dashboard1?:embed=y&:display_count=no

    Clear or clear as mud? :)

    ReplyDelete
  15. So it's back to the Bat Cave Batman.

    The ONLY way to get what we want is to have the user click the standard Export - CrossTab built into Tableau server. Opening the workbook will not work since it assumes you are starting a brand new session and so only your default (published) filters and params are available. Using any kind of URL will only work if you have single params to pick from (or max/min dates to pass). Since this only covers a small number of use cases, we must get the user to click an embedded worksheet on a dashboard and then use the Tableau standard export. In my case we were trying to do this with a 300,000 row download. So the last thing we want is to tax the vizSQL engine with rendering all that data. I think this approach may provide adequate speed although it is sinfully ugly.

    Assume you already have a dashboard with some filters (multi-select) etc. Then do this:

    1. Create a worksheet with the data you want on Details. Nothing on rows or columns.
    2. Ensure filters are global or applied to this worksheet from your "driver" worksheet.
    3. Choose Mark Type "Shape" and select one you like - I chose a circle.
    4. Make the Shape bigger and squish the screen down to show just a few.
    5. Put an instruction Title on such as: "To Export Details, Click on the circle below and then click on Export (icon above) and choose Crosstab".
    6. Go to your dashboard and drag the worksheet on whereever you want.
    7. Publish and test. The user will have to click in the circle to "Highlight" it and then do the export.

    For more fun: Since you are embedding a live worksheet on your dashboard it will take extra time to process. Get around this by adding a Boolean filter that the user can checkmark with a title such as "Fetch Details for export". The circle will disappear when this is false and reappear when it is true. Oh my gosh - it almost looks like workflow. Except it's ugly!

    Thoughts? Improvements?

    ReplyDelete
  16. I got this working!! only thing is how do i pass new parameter value? can i make it dynamic parameter in the URL?,

    ReplyDelete
    Replies
    1. Ritesh, you can find a list of all of the possible embed options here - http://onlinehelp.tableau.com/current/server/en-us/help.htm#embed_list.htm

      Delete
  17. I would like user selected filters to get passed to the acutal URL. In the example above, could the user check the 'Central' box and have that choice passed to the URL, changing the URL from:

    http://public.tableausoftware.com/views/OneMinuteDashboard/OneMinuteDashboard.png

    To:
    http://public.tableausoftware.com/views/OneMinuteDashboard/OneMinuteDashboard.png?Region=Central

    ReplyDelete
    Replies
    1. Kirk, first, your URL should be ?: (include the colon). As for your question, you should be able to build a calculated field that creates the URL with the syntax you want based on what the user selects in the filters and then use that calculated field in the source for the URL.

      Delete
  18. Can you pass the "All" option in a filter? I have a view that I want to render, but it is blank because one of the filters has nothing selected..
    This is what I would like to pass:
    views/ASY_PAK_Reports/TrendLine?SUB_FAMILY_NAME=BARTS&TEST_CLASS=ASSY&PACKAGE_LEADS=(All)
    However "(All)" is not selected when rendered.

    ReplyDelete
  19. Can you pass the "All" option in a filter? I have a view that I want to render, but it is blank because one of the filters has nothing selected..
    This is what I would like to pass:
    views/ASY_PAK_Reports/TrendLine?SUB_FAMILY_NAME=BARTS&TEST_CLASS=ASSY&PACKAGE_LEADS=(All)
    However "(All)" is not selected when rendered.

    ReplyDelete
    Replies
    1. This comment has been removed by a blog administrator.

      Delete
    2. I may have figured this out using the ~s0=All works.....

      views/ASY_PAK_Reports/TrendLine?SUB_FAMILY_NAME=BARTS&TEST_CLASS=ASSY&PACKAGE_LEADS~s0=All

      Delete
    3. Is it possible to select names with spaces, or names with & like the following:

      Region=South West

      South west as 1 region

      and Region=North & Scotland

      North & Scotland being 1 region

      Delete
    4. I'm not sure. What I would recommend is run a google search with that string and see how the URL is formatted. Tableau will use the same syntax.

      Delete
  20. Does this still work? I can't make it work on my workbook, and I can't seem to make it work using your viz either. I've noticed there is some extra profile information in the Tableau Public URL that wasn't in your blog post URL. Thank you!

    ReplyDelete
    Replies
    1. It doesn't work for Tableau Public anymore because they changed something. It should still work on your local Tableau Server though.

      Delete
    2. Hey Andy,

      Found this while doing a web search, FYI nowadays Tableau Public uses & instead of ? as the leading character after the view name. A couple of other notes from reading through the comments:

      - We can use URL parameters to filter sets, we first need to create a calculated field based on the Set such as IF [SetName] THEN 1 ELSE 0 END and then the URL parameter would use the name of the calculated field. I haven't tried this with the new v10 ability to use ad hoc groups in calculated fields but I expect it would work the same.
      - We can use URL parameters to set both field values as well as Tableau parameter values.

      Jonathan

      Delete
    3. Thanks for the updates Jonathan!!

      Delete
  21. how to pass filer parameters from URL to tableau dashboard for the filters created using Calculated Date having "Relative Filter" e.g. "Last 3 Years"

    ReplyDelete