SSRS Switch to evaluate

Posted on 2011-10-17
Last Modified: 2012-08-14
I'm trying to use Switch to color code cells on a report.  I'm trying to evaluate a string and color code a "days outstanding" cell if the number of days exceeds a threshold.  Currently I get the following error:

[rsRuntimeErrorInExpression] The BackgroundColor expression for the text box ‘Textbox49’ contains an error: Argument 'VarExpr' is not a valid value.

I'm using the Switch expression since I'll have about 10 different values to compare.

=Switch(Fields!String1.Value = "Bank of America" and DateDiff("d", today(), Fields!Date1.Value)*-1 >14, "Red", "Transparent")

Open in new window

Question by:mlehnen
    LVL 37

    Accepted Solution

    The Switch statement needs an even number of arguments.  See also:

    See snippet for a possible correction to your statement.
    =Switch(Fields!String1.Value = "Bank of America" and DateDiff("d", today(), Fields!Date1.Value)*-1 >14, "Red", True, "Transparent")

    Open in new window


    Author Comment

    That worked perfectly by adding the additional argument.  Thank you!

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now