Tableau Tips: Conditional Formatting




Hi All,
In this article under tableau tips we would see how to do conditional formatting in Tableau the similar way we do in excel.
We would be using our same data source for this : Sample Superstore data.
To get started first lets create the text table that we would like to format.
To do this drag Subcategories to the Rows and Region to the columns. Bring the measure profit ratio onto the marks card. Your view will now be the following:
cond1.PNG
Here we see the profit ratio for the subcategories displayed across region in the form of a crosstab. Now lets say we want to color the cells as under : Red denoting low profit for Profit percentage value less than 0 , Yellow denoting medium profit for Profit percentage between 0 an 25% and Green denoting profit percentage more than 25%.
To do this we create a calculated field for classifying the profits as under :
cond2.PNG

Once created drag this measure to the colors mark and choose the colors accordingly.
Click on the marks card and change it to Bar from automatic. Your worksheet will now look like this:
cond3.PNG
Create a calculated field Min(1) as under :
cond4.PNG
Drag this to the size on the Marks and you will have your text table formatted according to the condition.
Hope you guys enjoyed it.

 




4 Comments

  1. Hi Rahul I like your approach,but what if i want to compare 4 measure values(just for ex profit%,loss%,sales%,discount%) for the same condition

    • First of all thank you for your time.
      Answering to your question we can place dummy axis on the column for the individual measures and then apply conditional formatting. I will soon blog about that.

      • Thank You Rahul ,
        My Req is like sales%,profit%,discount% and Loss% with Up and Down arrows nearby.
        These 4 measure values will be changing based on the Period Parameter(YTD,QTD,MTD,WTD,Today)
        What will the if Condition look like or is there some other hack to do this
        (Unable to attach the sample image here)

Leave a Reply

Your email address will not be published.


*