5 Replies Latest reply on Aug 30, 2016 1:05 PM by Tom W

    Assign color to conditional statement while not visible

    Brian Pringle

      I have a dashboard with multiple worksheets.  On each worksheet is one single shape that I would like to color based on a conditional statement.  Basically, each one uses and IF...THEN statement to determine if something is true or false.  It is working for the TRUE/FALSE part.  But, what I want is for the shape to be green when true and red when false. 

       

      The problem is that on each sheet, it is most likely for the condition to be true.  I can manually set the TRUE color to green because TRUE is showing in the viz, but cannot figure out how to force the false color to be red without manipulating the database value to be false.  Is there a way to set the color for a condition when it does not appear in the viz?

        • 1. Re: Assign color to conditional statement while not visible
          Tom W

          Force your field to return a false value. This can be as simple as commenting our your real formula and just writing FALSE (or 'False' depending on the data type you're returning). Make this change, then color the value for false and re-instate the real formula.

          • 2. Re: Assign color to conditional statement while not visible
            Brian Pringle

            This works, but I have 16 data sources, each with the same calculation.  I would have to do this for all 16 data sources and 16 different worksheets.  I am trying to find a way to edit it directly.

             

            I have considered modifying it directly in the text file (.twb), but didn't know what else that would change.

            • 3. Re: Assign color to conditional statement while not visible
              Tom W

              You could look at modifying the XML behind the Tableau Workbook, but it's not really a recommended or supported route.

              If you want to go down this path, I'd save a trimmed down file with one connection and setup the color palette as required. Then edit the XML and you're looking for a section like this;

               

              <encoding attr='color' field='[none:MyCalc:nk]' palette='winter_10_0' type='palette'>

                          <map to='#90728f'>

                            <bucket>&quot;Good&quot;</bucket>

                          </map>

                          <map to='#9d9b3d'>

                            <bucket>&quot;OK&quot;</bucket>

                          </map>

                          <map to='#b9a0b4'>

                            <bucket>&quot;Bad&quot;</bucket>

                          </map>

                        </encoding>

              • 4. Re: Assign color to conditional statement while not visible
                Brian Pringle

                @Tom - That is how I resolved it.  I made changes to one of them so that it would show false, saved it, and then found the section where <bucket>false</bucket> was located.  I copied everything from <map> to </map> and pasted it below each section with <bucket>true</bucket> and saved it.  I then opened it in Tableau and published the workbook.  It appears to be working.

                 

                I wish there was an easier (safer?) way to achieve the same results.

                 

                Any one else have ideas on how to do this without editing the text file or setting a false conditional outcome?

                • 5. Re: Assign color to conditional statement while not visible
                  Tom W

                  There isn't an easier way that I know of. Having 16 data sources is going to result in you needing to do things like this manually from time to time unfortunately, and the lift is going to feel heavier because it's x16.

                   

                  Perhaps you might want to look an see if someone has suggested this idea or create your own over at the Ideas area?