Color code column values

  • How do I colorcode column values in SSRS based on values of 2 columns.

    Col1 , col2,(col2-should be color coded)

    If col1 = A and col2 = 1 then col2 = Blue

    If col1 = B and col2 = 2 then col2 = Red

    Thanks

  • In the report designer, select the cell you want to color code. Go to the properties, find the color (either foreground or background, whichever one you want), and replace the value there with an expression: Iif(<some condition>;"Red";"Green")


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • I am aware of that..

    but how do I write this condition in SSRS.

    If cell1=value1 and cell2=value2 then for cell2 color=red

  • You don't reference the cell but the corresponding field in the data source. E.g.:

    =IIF(Fields!Blocked.Value=1 And Fields!Current_Overdue.Value > 0, "Red", "Green")


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • By evaluating 2 columns(Blocked and Current_Overdue) and then color coding 2nd column.

    Can I have somethinglike this to color code a column (Current_Overdue)

    =IIF(Fields!Blocked.Value=1 And Fields!Current_Overdue.Value = 0, "Red", "Green")

    =IIF(Fields!Blocked.Value=2 And Fields!Current_Overdue.Value = 10, "Red", "Green")

    =IIF(Fields!Blocked.Value=3 And Fields!Current_Overdue.Value = 20, "Red", "Green")

    =IIF(Fields!Blocked.Value=4 And Fields!Current_Overdue.Value = 30, "Red", "Green")

    =IIF(Fields!Blocked.Value=5 And Fields!Current_Overdue.Value = 40, "Red", "Green")

  • sqlnewbie17 (1/25/2016)


    By evaluating 2 columns(Blocked and Current_Overdue) and then color coding 2nd column.

    Can I have somethinglike this to color code a column (Current_Overdue)

    =IIF(Fields!Blocked.Value=1 And Fields!Current_Overdue.Value = 0, "Red", "Green")

    =IIF(Fields!Blocked.Value=2 And Fields!Current_Overdue.Value = 10, "Red", "Green")

    =IIF(Fields!Blocked.Value=3 And Fields!Current_Overdue.Value = 20, "Red", "Green")

    =IIF(Fields!Blocked.Value=4 And Fields!Current_Overdue.Value = 30, "Red", "Green")

    =IIF(Fields!Blocked.Value=5 And Fields!Current_Overdue.Value = 40, "Red", "Green")

    That syntax is not correct. I assume you means something like this:

    =IIF( (Fields!Blocked.Value=1 And Fields!Current_Overdue.Value = 0)

    OR (Fields!Blocked.Value=2 And Fields!Current_Overdue.Value = 10)

    OR (Fields!Blocked.Value=3 And Fields!Current_Overdue.Value = 20)

    OR (Fields!Blocked.Value=4 And Fields!Current_Overdue.Value = 30)

    OR (Fields!Blocked.Value=5 And Fields!Current_Overdue.Value = 40), "Red", "Green")


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply