Monday, September 19, 2016

SSRS: Change Text Color for Better Readability

When using a tool that is meant to visualize data, it helps to make the visualization pleasing to look at. Typically, this kind of discussion would spiral out of control into an abyss of SSRS techniques and theories about visualization, but I just want to share a quick tip when working with tables containing a lot of numbers.

I have been working on a dashboard displaying the amount of helpdesk tickets that have been opened and processed. Part of this dashboard contains a table showing the amount of tickets that have been opened for different amounts of days; basically, divided into buckets if you will. Take a look at the screenshot below. Just glance at it and see what you can learn in just a second or two.

It’s not terrible, but you’re staring at a whole lot of black. Don’t get me wrong, I have no problem with that (my entire wardrobe is black), but since there are so many 0’s in the table, the user would have to take some time to make sure they are really reading the table to see the numbers they need. They could easily overlook something.

What I prefer to do, since there are so many 0’s throughout the table, is change the color to give all the 0’s a faded effect. Take a look at the next screenshot.

That is much easier to look at. The fields that have numbers can easily be recognized at a glance. To do this, on the design tab, select a text box and then view its properties in the properties pane of SSDT. Under the font section, click the dropdown next to the ‘Color’ property. At the bottom of the color palette menu is a link that reads ‘Expression…’. Click that and it opens the expression editor. The expression that we use here is as follows…

=iif (SUM(Fields!Day0_2.Value) > 0, "Black", "LightGrey" )

This is a simple ‘If, Then, Else’ expression. All it is stating is that if the value of the field in question is greater than 0, then the font will be black. If it is not greater than 0, then it will be light grey. Notice that I am actually using the sum of the values in that field. This is because I have row groups in the table that I can expand and collapse. If I were to remove the SUM part of the expression, then the colors would not turn out quite right.

Repeat this for each text box in the table.