Formatting reports can be a fun process. I personally look at myself as a Monet or Picasso when creating my reports. I start off with a blank canvas (report), get my materials to paint with (data for my report) and then I get to paint my masterpiece (report). Or at least that’s my goal when creating reports! J At any rate, we have all seen examples on how one could alternate row color of a tabular style report, but not too often does one come across an example where one could alternate the colors of entire groups of records. As such, I have provided a quick snippet you can use to tweak a report to have alternating group colors.
=IIF(RunningValue(Fields!Category.Value,COUNTDISTINCT,NOTHING) MOD 2 = 0,"PaleGreen","White")
As shown in figure 1 below, select the row you want to apply the alternating colors expression on (shown by the RED SQUARE). Then open the properties for your selection. Navigate to the Fill – Background Color property (shown by the YELLOW HIGHLIGHT) and enter the expression shown above.
Figure 1: Sample
Using the AdventureWorks database as my source and the above sample, you will have similar results as I have below.
Figure 2: Alternating Group Color Results (Zoomed Out)
For your convenience, I have included a zip file containing this example project. You can download it HERE.
Since I am writing this in order to help others and if you have found this article helpful, please rate it below. If you would like to provide constructive criticism to help me provide the information that you would like to see, I would love to hear that as well!
Until next time, “keep your ear to the grindstone” – Good Will Hunting
Brian K. McDonald, MCDBA, MCSD
Business Intelligence Consultant – Pragmatic Works Consultants
Email: firstname.lastname@example.org | Blog: BI Developer Network
Convert with DTS xChange | Develop with BI xPress | Process with TaskFactory | Document with BI Documenter