Alternate column colors in SQL 2008 Matrix
I have a Matrix with dynamic columns. I am grouping Matrix on one column group. I am trying to have a different color for every group. I hvae so far, three groups. How can I do that? A note, there is no data for every column group in every row.
January 20th, 2011 10:10pm

Hi, Please try the below 1. Go the reports code window (Menu Report--> Report Properties--> code tab) and paste the below to create the function getGroupCounter dim Counter as integer=0 public function getGroupCounter() as Integer Counter=Counter+1 return Counter end function 2. Go to the properties of the column group (Right click the column group and select group properties) 3. Click the variables tab on the left 4. Click on Add and set Name as GroupCountValue and set the expression (in the expression window) as =Code.getGroupCounter This expression sets the group variable to hold its running count value. 5. Click OK 6. Now in the matrix, click the column handle (that selects the whole column) for the column group, in properties window, set the below expression for background color =iif(Variables!GroupCountValue.Value mod 2 =0,"yellow","green") This would display the alternate colors green and yellow for the columns If you need to display different colors for each column, ten use the switch function, as shown below =switch(Variables!GroupCountValue.Value=1, "yellow",Variables!GroupCountValue.Value=2,"green",Variables!GroupCountValue.Value=3,"red") 7. Run the report and observe the result. Hope this helps. Feel free to discuss if you need any further help. Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH
Free Windows Admin Tool Kit Click here and download it now
January 21st, 2011 2:13pm

Is this possible in SSRS 2005, i do not see the option to add a variable. Thanks, Michael
January 21st, 2012 3:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics