Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Need help with IIF please

Need help with IIF please

Need help with IIF please


I am a newb to SSRS and need some help with an IIF. Can anyone tell me how to achieve this please???

I need to check two date fields, display the first one if it's available, display the second one if the first is not available and if both dates are missing, display a "N/A".

Any assistance appreciated ~ K

RE: Need help with IIF please

Any of the 5 expressions below should work. The last one is more readable for me because the conditions are expressed in the positive and there isn't any conditional nesting involved.


=IIf(Not IsNothing(Fields!Date1.Value), Fields!Date1.Value, IIf(Not IsNothing(Fields!Date2.Value), Fields!Date2.Value, "N/A")

=IIf(IsNothing(Fields!Date1.Value), IIf(IsNothing(Fields!Date2.Value), "N/A", Fields!Date2.Value), Fields!Date1.Value)

=IIf(IsDate(Fields!Date1.Value), Fields!Date1.Value, IIf(IsDate(Fields!Date2.Value), Fields!Date2.Value, "N/A"))

=Switch(Not IsNothing(Fields!Date1.Value), Fields!Date1.Value, Not IsNothing(Fields!Date2.Value), Fields!Date2.Value, True, "N/A")

=Switch(IsDate(Fields!Date1.Value), Fields!Date1.Value, IsDate(Fields!Date2.Value), Fields!Date2.Value, True, "N/A") 

RE: Need help with IIF please

The other thing you could consider is in your dataset using a COALESCE on the fields so you can eliminate the IIF on the report

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close