1 Reply Latest reply on Oct 3, 2013 9:35 AM by Sarah Rowe

    Exporting data using view extension with filters?

    Sarah Rowe

      Hi Tableau Community,


      I am really, really hoping there is a way to do what I am trying to accomplish.


      Basically I am trying to make a user-friendly data download interface within our tableau dashboards. What I have is a button on a dashboard (its simply a view with a down arrow shape) that is tied to an action, which calls a URL on select. The URL it calls is another view in the current workbook with a ".csv" extension added on so that it starts a download in the user's browser. This works like a dream. However, my main problem is that my dashboard as a lot of filters in it at the moment. I want the filters that the user has selected to apply to the data they are trying to download. However, it looks like the filters do not persist when the ".csv" extension is added to the view. Is there a way to make the filters persist, perhaps a parameter I can add in the URL?


      Thanks, Sarah

        • 1. Re: Exporting data using view extension with filters?
          Sarah Rowe

          I have struggled with this issue for last three days and finally came up with my own solution that I wanted to post here in case others come across this thread.


          Important points:

          • - Tableau requires dates to be passed in the following format: “yyyy-mm-dd”.
          • - Because we are working with date ranges, we have the issue of getting all the dates in the range to export.
          • - There is no >= or <= operators available when passing filter values via a URL

          How I got around this: My solution was to pass filter values to the “Date Month” field in the URL. This way, all dates that fall within a date month for which we are filtering will be exported. My main problem was that the user is not selecting individual months, instead the user is selecting a range of dates defined by a parameter. So the user selects values like “Last 3 months”, “Last month”, etc. So, in my end solution, my url string looks something like this: http://tableauserver/...../WorkbookDash.csv?DateMonth=<FILTERVALUES(Calc2)> which when I click on it resolves to something like this: http://tableauserver/...../WorkbookDash.csv?DateMonth=2013-01-01,2013-02-01,2013-03-01 My solution is as follows:

          • - Create a new calculated field (lets call this Calc1) that derives the date values to select based off of the time frame selected by the user
          • - Create another calculated field (lets call this Calc2) that is a varchar field that constructs the month/year of Calc1 in the format of yyyy-mm-dd, where “dd” is always “01”. The key here is this MUST resolve to a string so the default Tableau date formatting doesn’t override our format when we use this as a filter.
          • - Drag Calc2 onto the filter pane and select “Show filter”. Now you will see all of the date month strings that are available in the database. Make sure this filter values are showing as a multi-select list.
          • - Here is the KEY step that makes this work: Make sure you click on the filter control for Calc2 and select “Only Relevant Values”. This will ensure that only the months that correspond to the date range the user has selected appear in the filter drop down.
          • - Place the new filter on the dashboard where the URL action will be located. If you don’t want to show this filter for aesthetic purposes, you can add a floating container on top of it to hide it from the users view.
          • - Publish and test your workbook! This should work like a charm.


          NOTES: For a while, I was using the “Test Link” option in the Dashboard Actions UI within Desktop to test out my solution. Plese note that this link will ONLY ever show you the first three values of the data you are selecting. I didn’t see any place where this was documented and I wasted a whole lot of time thinking my solution wasn’t working before I figured this out.


          I hope this helps anyone who has struggled with allowing a user to export data based on a date range.


          ~ Sarah