2 Replies Latest reply on Jun 30, 2016 10:23 PM by Dmitry Chirkov

    Custom SQL / Parameters Question

    Erik Wempa

      I'm looking to create a simple dashboard that reads in one datasource, but uses parameters within custom SQL to determine the exact cut of data to bring back.


      I'm familiar with custom SQL and using parameters within that, but my question is this:  Is there a way in Tableau to make it so that if a parameter is left blank, that portion of the WHERE clause is disregarded?


      For example, say I want to use three parameters on my dashboard:  Employee Name, Category and State.  The user might select "California" as the state and "Otto Parts" as the employee, but not care which Category the data falls under.


      In that instance, we want the custom SQL to disregard the Category field and pull only for Employee Name and State.  However, since you have to anticipate that the user might select valid options for all three fields, you need to account for all three in your custom SQL.


      Even if there was a way to get our Category parameters to default to a space/null on the dashboard, the WHERE clause would still look to resolve and therefore try to pull back something with Category equals space/null.  And we don't want that.  We just want it to forget about using that field in the WHERE clause - period.


      Is there a way to do this?