{"id":113,"date":"2012-02-15T02:57:28","date_gmt":"2012-02-15T02:57:28","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=113"},"modified":"2014-03-06T15:38:09","modified_gmt":"2014-03-06T15:38:09","slug":"data-driven-colored-text-for-reporting-services-reports","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/data-driven-colored-text-for-reporting-services-reports\/","title":{"rendered":"Data Driven Colored Text for Reporting Services Reports"},"content":{"rendered":"<p>In SSRS you can use data driven expressions to color code certain rows. This post will show you how to accomplish this.<\/p>\n<p>First thing is first. I\u2019m assuming you already have a report created. In this example, I\u2019m using the AdventureWorks database and I\u2019m running a report on Name, Email, Hire Date, Title and Pay Rate:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-114\" alt=\"SQL Freelancer SQL Server SSRS\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS.png\" width=\"624\" height=\"400\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS.png 624w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-300x192.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><\/p>\n<h3>Formatting Needs<\/h3>\n<p>I want to distinguish three different levels of pay. If the Employee makes $10.00 or less I would like to change the text Red. If the employee makes between $10.01 and $20.00 I would like to keep the text Black and if the employee makes more than $20.00 I would like to change the text Green.<\/p>\n<h3>Changing Text Color<\/h3>\n<p>First, go to the Design tab of Designer view and select all the fields in which the color of text needs to change. In this example, I&#8217;ll select all fields.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-115\" alt=\"SQL Freelancer SQL Server SSRS\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-1.png\" width=\"626\" height=\"111\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-1.png 626w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-1-300x53.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-1-624x110.png 624w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/a><br \/>\nNext, I&#8217;ll go to the Properties Window. If you don&#8217;t see this window you can choose View, Properties or simply hit F4.<\/p>\n<p>In the Properties Window click the arrow beside <strong>Color<\/strong> and choose <strong>Expression<\/strong>:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-116\" alt=\"SQL Freelancer SQL Server SSRS\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-2.png\" width=\"273\" height=\"808\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-2.png 273w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-2-101x300.png 101w\" sizes=\"auto, (max-width: 273px) 100vw, 273px\" \/><\/a><\/p>\n<p>In the Expression box type your VB expression and click OK. In this example I&#8217;m using the following:<\/p>\n<div>\n<pre>=SWITCH(Fields!Pay.Value &lt;= 10, \"Red\", Fields!Pay.Value &gt;= 20, \"Green\")<\/pre>\n<\/div>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-117\" alt=\"SQL Freelancer SQL Server SSRS\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-3.png\" width=\"543\" height=\"493\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-3.png 543w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-SSRS-3-300x272.png 300w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/a><br \/>\n<a href=\"http:\/\/www.mssqltips.com\/sqlservertip\/2612\/data-driven-colored-text-for-reporting-services-reports\/\" target=\"_blank\">Click here to view the rest of this post.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In SSRS you can use data driven expressions to color code certain rows. This post will show you how to accomplish this. First thing is first. I\u2019m assuming you already have a report created. In this example, I\u2019m using the AdventureWorks database and I\u2019m running a report on Name, Email, Hire Date, Title and Pay [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,29],"tags":[35,106,59,41,32,31],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-business-intelligence","category-reporting-services-ssrs","tag-bi","tag-business-intelligence","tag-development","tag-expressions","tag-sql-server-reporting-services","tag-ssrs"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":1,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":118,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/113\/revisions\/118"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}