3 Replies Latest reply on Jul 13, 2015 2:30 PM by Tamas Foldi

    Custom query in Tableau

    Adam Nagy

      Hello Tableau Community,


      I'm interested in custom queries on data sources somehow in Tableau.

      Typical use-case: I want to visualize a scatter plot in Tableau but later on I want to filter the data with some custom logic I have written.

      Is there any way to do this?

      I have made some research so far, and couldn't find a way, right now I'm trying the REST API, but it seems this is also a dead-end.

      I don't care if it's Tableau Server/Online/Public/etc.., I just want to find a way to do this custom filtering.




        • 1. Re: Custom query in Tableau
          Jonathan Drummey

          The ways you can filter in Tableau are via:


          - extract filters (applied when an extract is created/updated)

          - data source filters (applied to every query, no direct end-user control via web interface except via a parameter)

          - filters (fields on the Filters Shelf)

          - quick filters (fields on the Filters Shelf that display selection widgets)

          - parameters (which are tied to fields used as filters or data source filters)

          - Filter Actions

          - JavaScript API

          - URL parameters


          If your custom logic can be expressed as a Tableau calculated field or an R script then you can embed that inside Tableau and use the existing filters or quick filters. Otherwise you'd likely need to use the JS API.


          Last I knew, the REST API is more about administering Tableau (publishing workbooks, setting up permissions, etc.) and not so much about interaction with a viz.



          • 2. Re: Custom query in Tableau
            Adam Nagy

            Hi Jonathan,


            thank you for the expressive answer, that's what I call a informative answer!

            But one more thing I don't see: how would you done the filtering I mentioned with the JavaScript API?

            All I have learned about the JS API is I can use filters only as a, what you call, Tableau calculated field. Am I missing something?




            • 3. Re: Custom query in Tableau
              Tamas Foldi

              Hello Adam,


              To complete Jonathan's answer, you can also use R programming language to define calculated fields (=custom logic that you have written) and use it as a filter.


              If you can give some details on your use case then we might be able to give you less generic answers