4 Replies Latest reply on Feb 16, 2017 12:07 PM by Brian Cachuela

# Joining or Blending two tables that are designed differently

This is my first post so let me know if there's additional info you need.

I'm trying to create a visualization that will display both a list of primary and secondary products and the amount of sales for each.  Primary products are in one table and they are line by line.

Table 1

 Main Prods Sale Prod1 1 Prod2 1 Prod1 1 Prod2 1 Prod1 1 Prod1 1 Prod2 1

Secondary products are in another table and have a collection size field that is summed.

Table 2

 Sec Prods QTY ProdA 129 ProdB 73

Is there any way to have an end result like:

 Prods QTY Prod1 4 Prod2 3 ProdA 129 ProdB 73

Or

 Main Prods Sale Sec Prods QTY Prod1 4 Prod2 3 ProdA 129 ProdB 73
• ###### 1. Re: Joining or Blending two tables that are designed differently

Hi Brian,

If all titles are the same you could reach your first option based on a union

If all titles must be maintained "as is" you could reach your second option based on a union.

A union in Tableau is explained here

2 of 2 people found this helpful
• ###### 2. Re: Joining or Blending two tables that are designed differently

Brian,

You can pivot both tables only if you can join them by common key. If it is not a big deal, can you add a common key to both tables then join them on that key and then pivot both tables and then you can get what you want.

• ###### 3. Re: Joining or Blending two tables that are designed differently

Brian,

I agree with Norbert that a union is going to give you what you need.  You may initially end up with a table that has all the rows of Table 1 and Table 2 instead of aggregated rows of Table 1 with rows of Table 2.  But this should be fine because you can use aggregation in the Tableau viz to sum together all the 1 values to get the quantity.

You might find a calculation like this

[Quantity]

ZN(Sale) + ZN(QTY)

helpful to combine the Sale and QTY fields.  Then treating that as a measure (specifically a SUM) in your view will give you correct results.

Hope that helps!

Joshua

• ###### 4. Re: Joining or Blending two tables that are designed differently

Thank you all for your response.  I'm still working on it and made some progress, but I see where you are all going with this.