jen
jen

Reputation: 39

Transfer column to row in Tableau

I will need a table as below in Tableau:

SalesID Results Q1      Q2        Q3      Q4
001     Target 105      106       105     111
001     Actual 104      107       100     120 
001 MeetTarget reddot  greendot   reddot  greendot

The target and actual volumes are in two different columns in the data source. What should I do to

  1. convert Target and Actual from Column to Rows,
  2. let tableau to compare the target and actual and then give it red or green color to indicate if it meets the target or not?

Upvotes: 0

Views: 132

Answers (1)

Vamsi
Vamsi

Reputation: 732

I think I have done what you are asking for. The idea is to use 2 blank fields (see the 2 green pills in the Columns shelf)
1) First Blank - place "Measure Values for Target and Actual in it and make it Text type, 2) Place the MeetTarget calculated field under the second blank field and make it a Circle type. (turn off labels and color them appropriately.

MeetTarget = IF [Actual]-[Target] >= 0 THEN 1 else 0 END

Note that the MeetTarget field is shown in the Dimensions, but it is to be in Measures. (image error)

I'll figure out a way to share the files with you and place the link here.

enter image description here

Detailed instructions - first create a calculated field called Blank and place 0 in the formula space. This creates a dummy field which we later use to split the views into 'text' and 'circles' Now drag the 'Blank' field into columns; it will automatically make it SUM(Blank). Drag the Blank field again and it will create the second SUM(Blank) beside the first. Now make them Dual axis by right-clicking on the second SUM(Blank) and selecting "Dual Axis". In the Marks shelf you now see 2 sections - SUM(BLANK) and SUM(BLANK)(2).

1) In the first SUM(BLANK) section in Marks Shelf, drag the Target field into the Marks Shelf (automatically becomes SUM(BLANK)). Now drag, Actual onto the Target pill on the same shelf to make it Measure Values. (if you still can't find out how this works, please google for 'Measure Values/Measure Names in Tableau'. Finally make the type of visual to "Text" in the dropdown under the first SUM(BLANK) section in the Marks Shelf.

2) In the second SUM(BLANK), drag the MeetTarget field and make it SUM(MeetTarget). Make the type of visual to "Circle" in the dropdown under the first SUM(BLANK) section in the Marks Shelf. Also drag MeetTarget onto Color and give appropriate colors (You need to convert it to a Dimension by right-clicking on the SUM(MeetTarget) under Color). And finally, under Label tab, turn off labels so that all you see is the circles and no text.

Upvotes: 1

Related Questions