Color Fill expression SSRS

Hi Experts,

I want to add the expression for the textbox [MTDD1].
if [MTDD1] is nothing, shows  light grey;
if  [MTDD1] <[MTDS1], shows Red (in the attachment "preview", number 19 should show in red), otherwise shows CornflowerBlue.

I wrote the query, the SSRS can pass the expression, but the fill color did not apply. Can  anyone help me on it. Thanks.

=switch(Fields!Step.Value = "Total"   and Fields!MTDD1.Value<Fields!MTDS1.Value, "Red",  "CornflowerBlue",
 IsNothing(Fields!MTDD1.Value)
        ,"LightGrey"
    , True
        , Nothing
    )

PreviewDesign
tanj1035Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ValentinoVBI ConsultantCommented:
Looks like your Switch parameters are not in the right order, they go like: condition 1, value 1, condition 2, value 2 and so on.

Try this:

=switch(Fields!Step.Value = "Total"   and IsNothing(Fields!MTDD1.Value)        ,"LightGrey"
    , Fields!Step.Value = "Total"   and Fields!MTDD1.Value < Fields!MTDS1.Value, "Red",
    , True        , "CornflowerBlue"
    )
0
tanj1035Author Commented:
Hi, Thanks for your reply.

I tried yours, but got the error message
"The BackgroundColor expression for the text box ‘MTDD1’ contains an error: [BC30588] Omitted argument cannot match a ParamArray parameter."

Actually, I am looking for the conditions like this
1)when Fields!Step.Value = "Total"   and Fields!MTDD1.Value<Fields!MTDS1.Value, IT HAS TO show "Red", otherwise "CornflowerBlue"
2)when [MTDD1] except Fields!Step.Value = "Total" is nothing, shows  light grey

I do not know if I express it clearly or not.  Looking forward to hearing from you.

Thanks.
0
ValentinoVBI ConsultantCommented:
I don't see why you would be getting that error, can you try troubleshooting by taking parts of the condition out of the expression and see if that works?  Or we could try writing the same logic differently:

=IIF(Fields!Step.Value = "Total",
  Switch( IsNothing(Fields!MTDD1.Value)        ,"LightGrey"
       , Fields!MTDD1.Value < Fields!MTDS1.Value, "Red"
       , True        , "CornflowerBlue"
     )
  , "CornflowerBlue"
)

BTW: the expression that I posted actually fulfills your stated requirements...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSRS

From novice to tech pro — start learning today.