2 Replies Latest reply on Nov 25, 2016 5:42 AM by Norbert Maijoor

    Color Legend Issue in Tableau

    Rekha Bathla

      Hi,

      We have created Gantt bar chart with shapes . We are showing bars and shapes with different colors based on calculated fields.

      One of the calculated Field(Violation Type)  is something like below:

      If Isnull(AvgDeliverytime) or isnull(Windowstart) or isnull(Windowend) then "Time Missing"

      elseif AvgDeliveryTime >= windowstart and AvgDeliveryTime=<WIndowEnd then "Good"

      elseif AvgDeliveryTime >=windowstart-30 and AvgDeliveryTime <=windowstart+30 then "Partial Out of Window"

      else "Failed" end

       

      Current situation is we don't have data meeting all the above conditions of Calculated field. We are getting only two Violation type- Good and Failed in tableau

      But we  need to show each value of calculation with some static color. Is there any workaround we can set the color of each value beforehand so that  whenever all the Violation Types get populated, each Violation Type show up correct color.?

       

      Thanks,

      Rekha 

        • 1. Re: Color Legend Issue in Tableau
          Simon Runc

          hi Rekha,

           

          So not done this before, but just tried on SuperStore and seemed to do the trick...

           

          So change your formula to anything where the data will generate at least one value for each of the options.

           

          something like....

           

          If [CustomerID] = "111" then "Time Missing"

          elseif [CustomerID] = "222" then "Good"

          elseif [CustomerID] = "333" then "Partial Out of Window"

          else "Failed" end

           

          and then go to the default settings for the field and set the colours/shapes you want for each one.

           

           

          Now go back and change your formula back to the original one (btw it's probably easier to just comment it out the original formula-> put in the dummy formula -> delete dummy formula -> remove commenting out)

           

          Now Tableau should remember the colours/shapes you want for each Violation type.

           

          Hope that does the trick.

          • 2. Re: Color Legend Issue in Tableau
            Norbert Maijoor

              Hi Rekha,

             

            Find my approach as reference below and stored in attached workbook version 9.3

             

            Based on using a "scaffold" template with all available values I am able to define 5 different position. 4 values + null.

            Please realize that the file is with the Template Colour Indicator is now primary. May it's not possible to work with a scaffold solution in your scenario.