5 Replies Latest reply on Aug 29, 2016 3:59 AM by AJAY KHATRII

    Handling Duplicate Rows After Joining

      I'm currently testing out Tableau and seem to be stumbling with the proper way to handle joins.  Here's some background and what I've tried:

       

      I have two tables, one is a table of persons and the other a table of operating systems.

       

      When I'm generating a graph that shows two dimensions and I just need to take a count of distinct matching records, I can do this without issue. In this example, each person has a gender and their preferred programming language specified, so I can quickly generate a graph that breaks down preferred languages as a column, and then a stacked chart of the distinct count of genders.

       

      Additionally, each person has ranked their comfort with the language on a scale of 1-5.  I want to graph the average comfort of individuals by language.  The problem now appears that I can't seem to exclude duplicate rows resulting from my join.  I've tried adding CNTD(personID) to the filter pane, but that does not affect my output.

       

      Since I will need to do reporting on Operating System, too, I can't just disjoin the data.  If I were pulling this data directly from a database, I suspect it would look something like:

       

      SELECT DISTINCT P.language, AVG(P.languageComfort)

      FROM Person P

      INNER JOIN OperatingSystem OS ON OS.personID = P.personID

      GROUP BY P.language

       

      Any help or guidance would be appreciated.