1 Reply Latest reply on Nov 1, 2016 10:42 AM by Maciek La

    Use an external parameter in custom query

    Matan Bracha

      Hi all!

      I have a Tableau Dashboard, that one of it's views is a cross-tab where each row holds data for a certain date.

      Now, this dashboard is sent in Email as a .png file. Usually the view is sent until yesterday's date (an automatic mail is sent after all the data is updated).


      Let me specify the current situation and my problem:

      I have a pipeline that runs all of the scripts that updates the data. the script that sends the Email is at the end of the pipeline.

      I started the pipeline process in the 30/10/2016. The data should be until the 29/10/2016 - yesterday.

      Let's say the process was delayed for some reason, and it got to the Email script in 31/10/2016 in the morning.

      My data now contains some of the 30/10/2016 data - but I don't want that data in the dashboard that I'll send in the 30/10/2016 Mail.

      This mail needs to send data ONLY until the 29/10/2016.


      I'm using Tableau 10.

      My data source is a custom SQL query with an extract connection.

      The extract-refresh is happening with a tabcmd command (in a bash script).

      What I want to know - is if there's any way to send an external parameter to the tableau, so I could limit the shown data?

      I want to add to the query "where date<DATEADD('day', X, TODAY())" --> where X is my number of days for the limitation (in case my process took too long).

      Maybe I can this condition as a filter somehow?


      Any help would be great... Thank you

        • 1. Re: Use an external parameter in custom query
          Maciek La

          Hi Matan,

          I believe that many of us would have different solution for this problem but this is how I would do that:

          It looks like data is refreshed by some ETL script, right? The easiest solution would be to store update date in the table somewhere. Either it is a separate table (and then left-joined to the main source) or in the main data table as a separate column. If you run a Custom SQL to push data to Viz then it's even easier - just add custom column with getdate() or now() depending on your database system.

          Then create a calculated field showing max from upload date and use it as max filter.






          If you find this update as solution, please consider marking it as helpful