If A Not Equal to B in SSRS

27.7k views Asked by At

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?

3

There are 3 answers

2
SQLHound On BEST ANSWER

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")
0
Arthur D On

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")
0
Hell Boy On

This Code will work for you :

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