Created
March 5, 2019 23:55
-
-
Save gdzierzon/d51e4f27b1428a292046d2338efdfba8 to your computer and use it in GitHub Desktop.
SSRS Code to Alternate Color for columns in Matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim yearGroup = New System.Collections.Hashtable() | |
Function GetGroupColor(groupName As String, color1 as string, color2 as string) As String | |
If yearGroup.ContainsKey(groupName) Then | |
Return yearGroup(groupName) | |
End If | |
Dim color = IIf(yearGroup.Count() Mod 2 = 0, color1, color2) | |
yearGroup.Add(groupName, color) | |
Return color | |
End Function | |
'code to use function if the column group is CalendarQuarter - you want to use the ReportItems collection instead of Fields because of NULL values | |
=Code.GetGroupColor(ReportItems!CalendarQuarter.Value | |
,"WhiteSmoke" | |
,"White" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment