2 Replies Latest reply on Nov 13, 2016 10:45 AM by Mark Lewis

    Help please! ;) Trouble blending data...

    Mark Lewis

      Hi - I have a single DataSource that has been provided via Tableau Server, so I can't get to the underlying SQL myself.

       

      In simple terms this SQL is doing a Union join on two tables: Customers, and Sales.

       

      In many reports this is working fine, but as you can see in the extract below, on the left is a common (to both tables) CustomerID, followed by 3 fields from the Customer table, and a final (sales) figure from the Sales table.

       

      What Tableau is doing is splitting the Customer record into two rows, the first from sales, which shows nulls for the 3 fields from Customer, and the sales figure, and the second row with the fields from Customer, and nothing in the sales column:

       

       

      What I want is for Tableau to merge those two rows, on the common Customer ID, by ignoring the nulls and just showing the relevant data.

       

      I've tried lots of approaches, but can't get it to work.

       

      Any suggestions greatly appreciated!

       

      Many thanks,

      Mark

        • 1. Re: Help please! ;) Trouble blending data...
          Mark Lewis

          I"d also like to be able to analyse the Sales by the Attributes in Customer, but I can't seem to do this as the Customer Attributes have no sales, and the Sales have no Customer Attributes - even though they are using the same CustomerID.

           

          I can't seem to get Tableau to use the CustomerID to lookup the data where it does exist.

          • 2. Re: Help please! ;) Trouble blending data...
            Mark Lewis

            I have found a partial answer on another thread. By using the following formula (changing field names as appropriate of course):

             

            IF ISNULL(LOOKUP(ATTR([Branch]),-1)) THEN ATTR([Branch])

            ELSEIF ATTR([Branch]) = LOOKUP(ATTR([Branch]),-1) THEN ATTR([Branch]) ELSE LOOKUP(ATTR([Branch]),-1)

            END

             

            This has resolved the issue I had in the first part of my question, so that I now get a single, merged row:

             

            I"m not sure U fully understand exactly why this works, but anyway, it seems to!

             

            But this still leaves me short of being able to analyse by these attributes (the point I raised in my first reply above), as, if I'm not displaying a structured table in the way shown above, the formula can't 'do it's thing'.

             

            So still on the lookout for any help.

             

            Thanks!

            Mark