UpwardD
UpwardD

Reputation: 767

If A Not Equal to B in SSRS

I understand IIF very well but I am trying to write an expression like the below in SSRS.

    IF A<>B,"D"
    =IIF(A <> B,"C","D") -- this doesn't work for me 

What replaces the sign, "<>" in the expression?

Upvotes: 3

Views: 29607

Answers (3)

Hell Boy
Hell Boy

Reputation: 981

This Code will work for you :

=IIF(Not A = B,"D","C")

Upvotes: 3

Arthur D
Arthur D

Reputation: 86

Using IIF, your true part should come first. I would switch the position of your C and D, because currently, if A<>B then it will show C, not D. Try this:

=IIF(A <> B,"D","C")

Upvotes: 0

SQLHound
SQLHound

Reputation: 562

The <> may not work if your values contain NULL so you may have to run a multiple case comparison such as:

IiF(A<>B OR A IsNothing OR B IsNothing, "C", "D")

Upvotes: 4

Related Questions