11 Replies Latest reply on Aug 23, 2013 9:28 AM by Jackie Klein

# Apply coloring to value cells based on conditions of value

Hi,

I have a tabular (text) report that I am trying to apply coloring to the value cells if the value meets certain conditions.  I'm not seeing how I can achieve this on a text report.  Attached is a sample.  The sample has only two measure values, whereas my actual file as 9 measure values, 2 of which I want to add coloring conditions to.  For example, I want to make the Sales green when >= \$75,000.  It would look something like this (shown using a percentage metric instead):

• ###### 1. Re: Apply coloring to value cells based on conditions of value

Jackie,

You can do this by customizing the color legend.  Use a custom diverging palette, 2 step color and set the center value to 75,000.  I've attached a workbook to demonstrate.  Hope it helps!

Regards,

Joshua

• ###### 2. Re: Apply coloring to value cells based on conditions of value

Hi Joshua,

Nice and simple solution. I did something more complicated (created a coloring calculated field):

Sales > \$75k? = SUM([Sales])>75000

and then adjusted the colors for true/false.

The only situation I see this approach being better for is if you needed to have a dynamic threshold via a parameter (easily change the 75000 to determine which cell are colored).

Other than that, your solution seems better to me!

Pedro

• ###### 3. Re: Apply coloring to value cells based on conditions of value

Hi Joshua,

I don't think your solution will work for me as the sample workbook you sent shows Sales labels for the Profit measure, and I want to keep the labels separate - one label for Sales and one for Profit.  I will also have two different conditions - one for Sales and one for Profit.  Please let me know.

Thanks!
Jackie

• ###### 4. Re: Re: Apply coloring to value cells based on conditions of value

Jackie,

That is a good point.  Here is a possible solution that builds on the previous one.  Please let me know if you have any questions.  I'd be happy to answer!

Regards,

Joshua

• ###### 5. Re: Re: Apply coloring to value cells based on conditions of value

Pedro,

That's a great approach!  It does have the benefit of allowing interactivity and I can't think of any real downside.

Regards,

Joshua

• ###### 6. Re: Apply coloring to value cells based on conditions of value

Thanks - but as mentioned in my original post, I have more than two fields on my report, so not sure if your solution will still work?  Also the two fields that I want the color coding for are calculated fields and I don't see how to do a MIN function with those.

• ###### 7. Re: Apply coloring to value cells based on conditions of value

Jackie,

Would it be possible to post a packaged workbook with all the measures including the calculated ones?

--Joshua

• ###### 8. Re: Re: Apply coloring to value cells based on conditions of value

Here you go.  The first two measures (% fields) are the one's that I would like the coloring for.  Thanks!

• ###### 9. Re: Re: Apply coloring to value cells based on conditions of value

Jackie,

I spent some time working on the workbook you supplied and I have to admit that I haven't figured out a way to achieve exactly what you want.  Even Tableau 8's ability to have two fields encoded by Color didn't work in this case because Measure Values is treated as a continuous field and thus can't share Color with Measure Names.

Maybe someone else will have some ideas.

Regards,

Joshua

• ###### 10. Re: Re: Apply coloring to value cells based on conditions of value

Jackie,

Are you looking to color just the two rows (Profit Ratio and Shipping Cost Per Sales)?

Pedro

• ###### 11. Re: Re: Apply coloring to value cells based on conditions of value

Yes, looking to color just those two fields for now, however may have one or two more to color in the future.