2 Replies Latest reply on Jul 30, 2018 11:24 PM by Shah M

    DISTINCT on one column, with multiple columns returned

    Shah M

      Hello folks,

       

      My maiden post, having started learning Tableau for school assignment just a week ago!

      Online search has only got me to the PARTITION keyword for MSSQL, and others just a little too complicated for me so far.

       

      So I have joined data from a few tables into a larger table (db view actually, for now) for Tableau to work off from, and when I drill down to the data of one 'row' in Tableau, I get smthg like this:

       

      C.idHTCityDatediff1Datediff2PricediffT.id1T.id2TPrice1TPrice2
      113mJ-5215456200185
      113mJ-53104515200190

       

       

      I gather from search that I can use PARTITION to get only 1 row because I do not want T.id1 duplicated like above. And I have successfully tried that within MSSQL.

      But here I need to do this after Tableau's filter on my view.

       

      How could this be accomplished?

       

       

       

      Thanx & Rgds,

      SM

        • 1. Re: DISTINCT on one column, with multiple columns returned
          Ken Flerlage

          You don't typically need to use complex SQL like PARTITION. But, can you share a bit more detail about your underlying data and what you are trying to do with it? If possible, can you share a sample of your data. If it's sensitive data, then take a look at the following for tips on how to anonymize it: Anonymize your Tableau Package Data for Sharing

          • 2. Re: DISTINCT on one column, with multiple columns returned
            Shah M

            I have joined 4 tables viz. sale transaction, home, location and instances of govt ruling to build that view I mentioned.

             

            The view also contains the price difference between 2 homes of similar attributes including city, and the transaction date differences of both homes against each of the ruling instances.

            My objective is to show the average price differentials in various cities, where in Tableau I could allow the interactive nature of allowing the adjustment of valid date differences eg. transactions before and after the ruling instances.

             

            Yes, I think it could be possible to achieve this _as_ I build the db view before presented to Tableau, but I thought I could do it after.

             

            Let's see if this makes enough sense. I can try to share a sample later, but no guarantee as yet.

             

             

            Thanx & Rgds,

            SM