'Tableau rotating data table
I have a dataset that looks like this in Tableau.
Name Subject Grade
Mina Math 28
English 92
Science 10
Bill Math 19
English 10
Science 38
Kay Math 39
English 92
Science 83
I need the data to look like this
Name Math English Science
Mina 28 92 10
Bill 19 10 38
Kay 39 92 83
How can I do this in Tableau? I am assuming I need to create a calculated field. Just not sure how to approach this as I am a beginner.
Solution 1:[1]
As Alex Blakemore suggested, you could pivot your entire dataset in the data source page itself, but I am assuming the first view you have is a Worksheet with Name, Subject, Grade fields in columns of the worksheet, and you would like to present your data as in the second view without modifying your data source.
It's possible by creating three calculated fields:
Math:
IF [Subject] = "Math" THEN [Grade] END
English:
IF [Subject] = "English" THEN [Grade] END
Science:
IF [Subject] = "Science" THEN [Grade] END
Now try dragging Name, Math, English and Science fields into the columns of the Tableau Worksheet and you should be able to get what you need without actually pivoting your data source itself. Hope this helps!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ani Palakurthi |
