hk2
hk2

Reputation: 487

Conditional formatting on particular columns in Tableau

I have a sample dataset on which I want to perform conditional formatting. In the given sample of data, if values in column Item3>=Item1 then the corresponding records in Item3 should be highlighted in green else in red. Similarly, if values in column Item4>=Item2 then the corresponding records in Item4 should be highlighted in green else in red.

| Group | Item1 | Item2 | Item3 | Item4 |
|-------|-------|-------|-------|-------|
| A     | 3     | 1     | 1     | 1     |
| B     | 4     | 3     | 4     | 3     |
| C     | 5     | 6     | 2     | 8     |
| D     | 9     | 4     | 10    | 6     |
| E     | 6     | 9     | 7     | 7     |
| F     | 4     | 5     | 5     | 7     |
| G     | 7     | 5     | 9     | 6     |

In the above example, rows 1 and 3 under Item3 column should be highlighted in red and rest of them in green while row 5 under Item4 column should be highlighted in red and rest in green.

I have tried creating a calculated field using if-else statement, but it highlights all the values. How can I achieve it for highlighting the cells in columns 'Item3' and 'Item4'?

Upvotes: 0

Views: 534

Answers (1)

Wade Schuette
Wade Schuette

Reputation: 1473

One way to achieve this Viz is to have 3 sheets. First sheet is group, item1, and item 2. Second sheet is group and item3. Third Sheet is group and item4. Create two calculated fields "3>1" and "4>2" and assign these as colors to second and third sheet respectively. Then make a dashboard with all three sheets floating, overlapping, adjusting which one is in front. I punted on titles.

Here's my result. enter image description here

And here: https://public.tableau.com/app/profile/wade.schuette/viz/color-columns/Dashboard1?publish=yes

Upvotes: 0

Related Questions