3 Replies Latest reply on Feb 23, 2015 1:37 PM by Matthew Dorhauer

    Column colour formatting based on criteria

    Matthew Dorhauer

      Hi There,


      My team and I would like to know how to generate the result table attached in Tableau. The element we don’t know how to produce with Tableau is some sort of conditional formatting for the columns. Basically, we need each column to be colour coded in a similar fashion to the attached picture. Each row of our data has a favourability rating assigned (between 0 and 100). O – 49 is negative (red), 50 is neutral (grey) and 51 – 100 is positive (green). We need the columns to display the total records amount which we have already done, but I believe we need expert instructions on how to do this colour coding. The answer could be calculated fields, cross tab, multiple axis, we are unsure???


      Any help much appreciated. Tableau seems like an excellent tool but we would like some pro tips regarding this formatting technique.

        • 1. Re: Column colour formatting based on criteria
          Tableau kumar

          As per my understanding, you are looking for "Conditional Formatting".


          The Following Example was created to know the Sales Performance.



          1) Create a calculation like below syntax.

          if Sum([Sales]) <= 5000 then "Red"

          elseif Sum([Sales]) >5000  and Sum([Sales]) <= 25000 then "Blue"

          elseif Sum([Sales]) >=25001  and Sum([Sales]) <= 50000 then "Orange"

          elseif Sum([Sales]) >=50001  and Sum([Sales]) <= 75000 then "Green"

          Else "Purple"





          2) Drag the City Column onto Row shelf, Sales on to Text Marks pane.

          And Drag the above calculation onto colors marks.






          to get your required put put,

          If [Rating] < 50 then "Red" elseif  [Rating] = 50 then "Gray" elseif  [Rating]  >50 then "Green"  end

          • 2. Re: Column colour formatting based on criteria
            KK Molugu



            You guys are on the right track and asking all the right question on your approach. With the sample data or the workbook, it is a little hard to build what you are looking for as sometime id depends on how your data is laid out.


            From your details above and the attached PDF, I put together a sample workbook using few records from superstore data set. I am not sure if you are looking to exactly replicate what you have in PDF of just trying to get a stacked bar graph with different colors. You can use your dimensions on the columns and use your favorability rating as your color dimension to show the bars as stacked.


            Below is a sample of stacked bar graph with total count at the top using dual axis.

            with total.PNG

            Since, I am using dual axis in the above to show the totals, it will be little tricky to show the average line graph. Below, I have the stacked bars with the average, but will lose the total count on the bars. Again, we can achieve that too with little bit heavy lifting.

            with avg.PNG

            One alternative is to show the total next to the average value as, again this is without heavy lifting.

            with all.PNG

            Hope this helps.


            • 3. Re: Column colour formatting based on criteria
              Matthew Dorhauer

              Thanks to you both. I now understand this clearly. This appears to be a very helpful forum for Tableau :-)