I received a question from a student recently about how to apply Excel-like conditional formatting in Tableau. This is a great feature in Microsoft Excel in which you can highlight cell values based on a rule you setup. In Tableau however, this isn’t as straight forward. Here are the simple steps to accomplish this using a simple calculation in Tableau.
- Create a new calculated field (right click in data pane > create > calculated field)
- Add your logic to the calculated field. Replace [field] with the field you want to compare to and whatever values you want for 0.2 and 0.8. These values are good for percentages but use whatever values make sense for your viz.
if [field]<0.2 then 'blue' elseif [field]>0.8 then 'blue' else 'black' end
- Use this as a color attribute for your viz
In a follow up post we’ll explore how to make these more dynamic using parameters and “top” logic instead of hard-coded values. Stay tuned!
More on my YouTube Channel here: https://www.youtube.com/BenSullinsDataGeekChannel