Dmitry Guyvoronsky
Dmitry Guyvoronsky

Reputation: 708

Column headers to cell values in Tableau

I have 2 data tables that I need to join together for analysis in Tableau desktop. Let's say for the sake of simplicity that one table contains height of individual persons (column per person) and another table contains weights for the same persons (again, column per person).

What I am trying to do is to join to tables on date and person, calculate weight/age ratio and group people in clusters. Can you suggest how to do that without changing the format of source data tables?

For example, let's imagine that the Height table looks like this:

Date        John  Jill
2015/08/19  180   160
2015/08/20  181   161
2015/08/21  182   160

And Weight table looks like this:

Date        John  Jill
2015/08/19  10   20
2015/08/20  10   21
2015/08/21  10   20

How do I convert these tables into something like this for subsequent group by on Date and Person?

Date        Person Height Weight
2015/08/19  John   180    10
2015/08/19  Jill   160    20
2015/08/20  John   181    10
2015/08/20  Jill   161    21
2015/08/21  John   182    10
2015/08/21  Jill   160    20

Upvotes: 0

Views: 326

Answers (1)

Vadym B.
Vadym B.

Reputation: 681

I have 2 solutions for you

1) You can import data to any SQL storage and then pivot your data the way you want (MySQL example here: MySQL pivot table)

2) Using only Tableau (at least version 9.0) :

  • Connect 1st file to tableau -> and pivot it. Then rename values as "name" and 'height' enter image description here

  • Connect the second table as the second data source. Do the same with it.

  • Then drag-and-drop values from 2 data sources to the view ( if you have complex data you may need to adjust blending options) enter image description here

Upvotes: 1

Related Questions