Format Table Columns based on Column Group Value


I have a report that has a table on it.

The table contains a column group. I would like to change the color of the columns backgrounds based on the group value. Is this possible? E.g. if the group value is "BAR" then the columns will be purple, if the group value is "BW" then the columns will be blue etc.

Thanks, Greg
Who is Participating?
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
Should be.  

Right-click:Properties on textbox, click Fill, click the function (fx) button next to Fill Color, then enter an expression with nested IIF statements that goes something like this

=IIF(Fields!ColumnName.Value = "BAR", Purple, IIF(Fields!ColumnName.value="BW", Blue, Black))

Open in new window

ValentinoVConnect With a Mentor BI ConsultantCommented:
Jim's answer should help you.  But I'd like to add something to it: instead of using IIFs I'd use the Switch statement:

=Switch(Fields!ColumnName.Value = "BAR", Purple,
  Fields!ColumnName.value="BW", Blue
  true, Black)

Open in new window

More info on that last line: Adding an Else to your Switch
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.