12 Replies Latest reply on Jan 23, 2017 3:59 PM by Adam Balila

    Two filters on one column with respect to each other

    Adam Balila

      I would like to filter my data source by itself. In SQL it is just INNER JOINNING a table by itself.


      For example,


      SELECT table1.*
      FROM table1 INNER JOIN (SELECT id FROM table1 WHERE variable = ‘X’ AND value = 1) q1 ON table1.id = q1.id
      WHERE table1.variable = ‘Y’


      As you can see I want to present only the variable which equals ‘Y’ with respect to variable =’X’ and value=1.

      I can also write it like this,


      SELECT *
      FROM table1
      WHERE variable = ‘Y’ AND id IN (SELECT id FROM table1 WHERE variable = ‘X’ AND value = 1)


      I am using a long data file which means my primary key is 'id' and 'variable' together. So, I want all the variable = ‘Y’ data to be presented only if the 'id' has variable = ‘X’ AND value = 1. How do I translate this process in Tableau dashboard?

      Any suggestions on how to do it without inner joining the data source by itself? I tried the inner join way but my data is very large which resulting in too much processing time and it makes all the other processes extremely slow.