DateDiff In SSRS Problem

  • Hello and good morning,

    I'm doing 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 still no luck, the field comes with "#Error

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

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

    Thanks

  • are you trying to get a boolean value?

    DateDiff returns an integer, your example seems to be doing this:

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

    'would be the same as this witht he right dates

    FORMAT(34>= 30)

    what value do you want to be int he field?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hey Lowell, thanks for your help, I'm trying to get the number of days less or equal 30 days.

    the report supposes to show the patients whose got admitted within 30 days only, that's why I'm calculating the days

  • Thanks, i did it through a T-SQL statement, I hate SSRS expressions 😉

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply