DateDiff In SSRS Problem

684    Asked by ranjana-admin in Devops , Asked on Jul 15, 2021

 I am trying to do a report in SSRS and trying to calculate the number of days between the patient's re-admission and the original admission date.

Here's my formula

=FORMAT (DateDiff("DAY", Fields!ReAdmitDate.Value, Fields!AdmitDate.Value) >= 30)

 

tried =(DateDiff("DAY", Fields!ReAdmitDate.Value, Fields!AdmitDate.Value) >= 30)

 

but I am not able to resolve it, the field comes with "#Error

 

Data type from the DB is "DATE" , format is 06/17/2010 12:00:00 AM

 

Any idea what I'm missing in my code?? 


Answered by Jan Ferguson

If your column data type is DateTime, your ssrs DateDiff expression should look like this:

  =DateDiff(DateInterval.Minute, Fields!tour_start_time.Value, Fields!tour_end_time.Value)

or

=DateDiff("n", Fields!tour_start_time.Value, Fields!tour_end_time.Value)
Generally, DateDiff returns an integer. Your example seems to be doing this:
FORMAT (DateDiff("DAY", Fields!ReAdmitDate.Value, Fields!AdmitDate.Value) >= 30)
FORMAT(34>= 30)

Your Answer

Interviews

Parent Categories