CJ Boat
CJ Boat

Reputation: 71

DateDiff if SSRS unless NULL

So, I am trying to get a DateDiff to work, but only if one of the items is not null. I have

=DateDiff("d",Today,Fields!Seller_Approval_Date.Value)

but if Seller_approval_date is null, I want it to display a N/A.

I want it to display kind of the following, but I want it to display a difference in today's day and the displayed date:

Display error

Upvotes: 0

Views: 4226

Answers (2)

Sam
Sam

Reputation: 7313

If you want to do this in reporting services then you can use

=Iif(IsNothing(Fields!Seller_Approval_Date.Value),"N/A"
,DateDiff("d",Today,Fields!Seller_Approval_Date.Value))

or if that doesn't work you could try a comparison against the length of the value.

=Iif(Len(Trim(Fields!Seller_Approval_Date.Value)) = 0
,DateDiff("d",Today,Fields!Seller_Approval_Date.Value),"N/A")

Final working expression

=Iif( IsDate(Fields!Seller_Approval_Date.Value), 
DateDiff("d",Today,Fields!Seller_Approval_Date.Value), "N/A" ) 

Upvotes: 1

Mike
Mike

Reputation: 2559

Try

=ISNULL(DateDiff("d",Today,Fields!Seller_Approvale_Date.Value), 'N'A')

Upvotes: 0

Related Questions