0

I'm trying to get my report to display different color cells, depending on the condition. This is my current code:

=Switch(Fields!DaysToExpiration.Value > 31, "Green",  
        Fields!User_Certification_Status.Value = 8, "Firebrick”,
        Fields!User_Certification_Status.Value = 13, “Orange”,
        Fields!User_Certification_Status.Value = 11, “Orange”,
        Fields!User_Certification_Status.Value = 10, “Orange”,
        Fields!User_Certification_Status.Value = 12, “Orange”,
        Fields!DaysToExpiration.Value <= 30, "Yellow", 
        1=1, "Gray")

So, my problem lies with the last part of the code. I'm using a matrix view, which means there are some cells where there is no data. SSRS is treating these like they have a value though (I'm assuming 0). This means that all the blank ones automatically turn to yellow, rather than gray. How can I get around this? Thank You.

1

Yeah, SSRS can be a little cumbersome with its handling of empty/null values. Try adding an explicit isnothing() before the yellow option:

=Switch(Fields!DaysToExpiration.Value > 31, "Green",  
    Fields!User_Certification_Status.Value = 8, "Firebrick”,
    Fields!User_Certification_Status.Value = 13, “Orange”,
    Fields!User_Certification_Status.Value = 11, “Orange”,
    Fields!User_Certification_Status.Value = 10, “Orange”,
    Fields!User_Certification_Status.Value = 12, “Orange”,
    IsNothing(Fields!DaysToExpiration.Value), "Gray",
    Fields!DaysToExpiration.Value <= 30, "Yellow", 
    1=1, "Gray")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.